Skip to content

Commit

Permalink
files: extract pre-processing part from merge()
Browse files Browse the repository at this point in the history
I'll make the first half generic over T: AsRef<[u8]>.
  • Loading branch information
yuja committed Jul 18, 2024
1 parent 5a58030 commit e5b49c7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ pub fn merge(slices: &Merge<&[u8]>) -> MergeResult {
// more than 3 parts?
let num_diffs = slices.removes().len();
let diff_inputs = slices.removes().chain(slices.adds());
merge_hunks(&Diff::by_line(diff_inputs), num_diffs)
}

let diff = Diff::by_line(diff_inputs);
fn merge_hunks(diff: &Diff, num_diffs: usize) -> MergeResult {
let mut resolved_hunk = ContentHunk(vec![]);
let mut merge_hunks: Vec<Merge<ContentHunk>> = vec![];
for diff_hunk in diff.hunks() {
Expand Down

0 comments on commit e5b49c7

Please sign in to comment.