Skip to content

Commit

Permalink
Show simple conflicts simply
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Sep 5, 2024
1 parent e8faacc commit 8acbfe3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cli/src/diff_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,27 @@ fn show_structured_conflict_diff_hunks(
text = BString::new(print_context(formatter, text.into(), false)?);
}
last_hunk_unmodified_text = Some(Some(text.into()));
} else if let [DiffExplanationAtom::ChangedConflictAdd {
left_version,
right_version,
}] = explained_hunk.as_slice()
{
// This is a simple diff
if let Some(Some(text)) = last_hunk_unmodified_text {
print_context(formatter, text, true)?;
}
last_hunk_unmodified_text = Some(None);
// TODO: These headers would not be necessary if we could indent both the
// context before the diff *and* the context after by a space.
writeln!(
formatter.labeled("hunk_header"),
"<<<<<<<<<<<<< Unconflicted diff BEGIN"
)?;
show_diff(formatter, left_version, right_version)?;
writeln!(
formatter.labeled("hunk_header"),
">>>>>>>>>>>>> Unconflicted diff END"
)?;
} else {
if let Some(Some(text)) = last_hunk_unmodified_text {
print_context(formatter, text, true)?;
Expand Down

0 comments on commit 8acbfe3

Please sign in to comment.