ok/jj
1
0
Fork 0
forked from mirrors/jj

working_copy: if a file's recorded mtime is equal to the state's mtime, set to 0 early

This commit is contained in:
Martin von Zweigbergk 2021-10-30 22:19:51 -07:00 committed by Martin von Zweigbergk
parent 033bfe7d5b
commit 856b219943

View file

@ -396,8 +396,13 @@ impl TreeState {
// when we wrote the file.
new_file_state.mark_executable(current_entry.is_executable());
}
let clean =
current_entry == &new_file_state && current_entry.mtime < self.own_mtime;
// 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_entry.mtime >= self.own_mtime {
current_entry.mtime = MillisSinceEpoch(0);
}
let clean = current_entry == &new_file_state;
if !clean {
let file_type = new_file_state.file_type.clone();
*current_entry = new_file_state;