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

merge_tools: borrow file contents without consuming Merge object

This commit is contained in:
Yuya Nishihara 2023-11-06 16:28:44 +09:00
parent 895bbce8c0
commit e4b0e629c9

View file

@ -307,12 +307,12 @@ pub fn run_mergetool_external(
} else {
vec![]
};
let (mut removes, mut adds) = content.take();
let files: HashMap<&str, _> = maplit::hashmap! {
"base" => removes.pop().unwrap().0,
"right" => adds.pop().unwrap().0,
"left" => adds.pop().unwrap().0,
"output" => initial_output_content.clone(),
assert_eq!(content.num_sides(), 2);
let files: HashMap<&str, &[u8]> = maplit::hashmap! {
"base" => content.get_remove(0).unwrap().0.as_slice(),
"left" => content.get_add(0).unwrap().0.as_slice(),
"right" => content.get_add(1).unwrap().0.as_slice(),
"output" => initial_output_content.as_slice(),
};
let temp_dir = new_utf8_temp_dir("jj-resolve-").map_err(ExternalToolError::SetUpDir)?;