mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-09 05:58:55 +00:00
working_copy: update file state for conflict and non-conflict the same
When a file's mtime has changed on disk, we update our record of that mtime, but we did so in a separate place for conflicts compared to non-conflicts. Let's reuse it.
This commit is contained in:
parent
10a2a15993
commit
c7e736f73c
1 changed files with 5 additions and 5 deletions
|
@ -830,13 +830,15 @@ impl TreeState {
|
|||
current_file_state.mtime = MillisSinceEpoch(0);
|
||||
}
|
||||
if current_file_state != &new_file_state {
|
||||
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);
|
||||
// If the file contained a conflict before and is now a normal file on disk, we
|
||||
// try to parse any conflict markers in the file into a conflict.
|
||||
if let (
|
||||
Some(TreeValue::Conflict(conflict_id)),
|
||||
FileType::Normal { executable: _ },
|
||||
) = (¤t_tree_value, &new_file_state.file_type)
|
||||
) = (¤t_tree_value, &new_file_type)
|
||||
{
|
||||
let mut file = File::open(&disk_path).unwrap();
|
||||
let mut content = vec![];
|
||||
|
@ -846,7 +848,6 @@ impl TreeState {
|
|||
.update_from_content(self.store.as_ref(), &repo_path, &content)
|
||||
.unwrap()
|
||||
{
|
||||
*current_file_state = new_file_state;
|
||||
if new_conflict != conflict {
|
||||
let new_conflict_id =
|
||||
self.store.write_conflict(&repo_path, &new_conflict)?;
|
||||
|
@ -856,9 +857,8 @@ impl TreeState {
|
|||
}
|
||||
}
|
||||
|
||||
let file_type = new_file_state.file_type.clone();
|
||||
*current_file_state = new_file_state;
|
||||
let file_value = self.write_path_to_store(&repo_path, &disk_path, file_type)?;
|
||||
let file_value =
|
||||
self.write_path_to_store(&repo_path, &disk_path, new_file_type)?;
|
||||
tree_builder.set(repo_path, file_value);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue