forked from mirrors/jj
working_copy: in mtime race case, don't mutate current state
There's a comment saying that mutating the file's current state simplifies later logic, but I don't think that's true. It might have been true in the past, when we had `FileType::Conflict`.
This commit is contained in:
parent
8d1cb1e1d7
commit
7cc916e4f1
1 changed files with 3 additions and 5 deletions
|
@ -825,11 +825,9 @@ impl TreeState {
|
|||
}
|
||||
// If the file's mtime was set at the same time as this state file's own mtime,
|
||||
// then we don't know if the file was modified before or after this state file.
|
||||
// We set the file's mtime to 0 to simplify later code.
|
||||
if current_file_state.mtime >= self.own_mtime {
|
||||
current_file_state.mtime = MillisSinceEpoch(0);
|
||||
}
|
||||
if current_file_state != &new_file_state {
|
||||
if current_file_state != &new_file_state
|
||||
|| current_file_state.mtime >= self.own_mtime
|
||||
{
|
||||
let new_file_type = new_file_state.file_type.clone();
|
||||
*current_file_state = new_file_state;
|
||||
let current_tree_value = current_tree.path_value(&repo_path);
|
||||
|
|
Loading…
Reference in a new issue