diff --git a/cli/src/merge_tools/external.rs b/cli/src/merge_tools/external.rs index 1425a66d5d..e3288cada7 100644 --- a/cli/src/merge_tools/external.rs +++ b/cli/src/merge_tools/external.rs @@ -131,7 +131,7 @@ pub fn run_mergetool_external( ) -> Result { let initial_output_content: Vec = if editor.merge_tool_edits_conflict_markers { let mut materialized_conflict = vec![]; - materialize_merge_result(&content, &mut materialized_conflict) + materialize_merge_result(content.clone(), &mut materialized_conflict) .expect("Writing to an in-memory buffer should never fail"); materialized_conflict } else { diff --git a/lib/src/conflicts.rs b/lib/src/conflicts.rs index 4da59c809c..9d6ff0212f 100644 --- a/lib/src/conflicts.rs +++ b/lib/src/conflicts.rs @@ -191,7 +191,7 @@ async fn materialize_tree_value_no_access_denied( if let Some(file_merge) = conflict.to_file_merge() { let file_merge = file_merge.simplify(); let content = extract_as_single_hunk(&file_merge, store, path).await?; - materialize_merge_result(&content, &mut contents) + materialize_merge_result(content, &mut contents) .expect("Failed to materialize conflict to in-memory buffer"); } else { // Unless all terms are regular files, we can't do much better than to try to @@ -215,7 +215,7 @@ async fn materialize_tree_value_no_access_denied( } pub fn materialize_merge_result( - single_hunk: &Merge, + single_hunk: Merge, output: &mut dyn Write, ) -> std::io::Result<()> { let slices = single_hunk.map(|content| content.0.as_slice()); @@ -461,7 +461,7 @@ pub async fn update_from_content( // copy. let mut old_content = Vec::with_capacity(content.len()); let merge_hunk = extract_as_single_hunk(simplified_file_ids, store, path).await?; - materialize_merge_result(&merge_hunk, &mut old_content).unwrap(); + materialize_merge_result(merge_hunk, &mut old_content).unwrap(); if content == old_content { return Ok(file_ids.clone()); } diff --git a/lib/tests/test_conflicts.rs b/lib/tests/test_conflicts.rs index 83a419c361..4d7ee7d790 100644 --- a/lib/tests/test_conflicts.rs +++ b/lib/tests/test_conflicts.rs @@ -1024,6 +1024,6 @@ fn materialize_conflict_string( let contents = extract_as_single_hunk(conflict, store, path) .block_on() .unwrap(); - materialize_merge_result(&contents, &mut result).unwrap(); + materialize_merge_result(contents, &mut result).unwrap(); String::from_utf8(result).unwrap() }