diff --git a/cli/src/merge_tools/external.rs b/cli/src/merge_tools/external.rs index 3025f376db..9ac546c352 100644 --- a/cli/src/merge_tools/external.rs +++ b/cli/src/merge_tools/external.rs @@ -144,7 +144,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 af6fbb7760..0e151a95f2 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,10 +215,10 @@ 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 merge_result = files::merge(single_hunk); + let merge_result = files::merge(&single_hunk); match merge_result { MergeResult::Resolved(content) => { output.write_all(&content.0)?; @@ -501,7 +501,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 7f37b81f10..79325b1e10 100644 --- a/lib/tests/test_conflicts.rs +++ b/lib/tests/test_conflicts.rs @@ -1000,6 +1000,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() }