mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-06 03:22:59 +00:00
working_copy: reduce scope of a content
variable
This also avoids reading non-file conflict from disk.
This commit is contained in:
parent
585c212617
commit
33a93b6d2d
1 changed files with 6 additions and 6 deletions
|
@ -966,14 +966,14 @@ impl TreeState {
|
|||
if let (Some(TreeValue::Conflict(conflict_id)), FileType::Normal { executable }) =
|
||||
(¤t_tree_value, &file_type)
|
||||
{
|
||||
let mut file = File::open(disk_path).map_err(|err| SnapshotError::IoError {
|
||||
message: format!("Failed to open file {}", disk_path.display()),
|
||||
err,
|
||||
})?;
|
||||
let mut content = vec![];
|
||||
file.read_to_end(&mut content).unwrap();
|
||||
let conflict = self.store.read_conflict(repo_path, conflict_id)?;
|
||||
if let Some(old_file_ids) = conflict.to_file_merge() {
|
||||
let mut file = File::open(disk_path).map_err(|err| SnapshotError::IoError {
|
||||
message: format!("Failed to open file {}", disk_path.display()),
|
||||
err,
|
||||
})?;
|
||||
let mut content = vec![];
|
||||
file.read_to_end(&mut content).unwrap();
|
||||
let new_file_ids = conflicts::update_from_content(
|
||||
&old_file_ids,
|
||||
self.store.as_ref(),
|
||||
|
|
Loading…
Reference in a new issue