mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-27 14:57:14 +00:00
working_copy: correct comment about stat accuracy
We don't take a write lock when writing a file; other processes can modify the file.
This commit is contained in:
parent
3d679de022
commit
d4aed83aa6
1 changed files with 3 additions and 3 deletions
|
@ -370,9 +370,9 @@ impl TreeState {
|
||||||
let mut contents = self.store.read_file(path, id).unwrap();
|
let mut contents = self.store.read_file(path, id).unwrap();
|
||||||
std::io::copy(&mut contents, &mut file).unwrap();
|
std::io::copy(&mut contents, &mut file).unwrap();
|
||||||
self.set_executable(disk_path, executable);
|
self.set_executable(disk_path, executable);
|
||||||
// Read the file state while we still have the write lock. That way there is no
|
// Read the file state while we still have the file open. That way, know that
|
||||||
// race with other processes modifying it. We know that the file exists,
|
// the file exists, and the stat information is most likely accurate,
|
||||||
// and we know that the stat information is accurate. (The mtime is set
|
// except for other processes modifying the file concurrently (The mtime is set
|
||||||
// at write time and won't change when we close the file.)
|
// at write time and won't change when we close the file.)
|
||||||
self.file_state(&disk_path).unwrap()
|
self.file_state(&disk_path).unwrap()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue