From 78c8a7dfe276115ab5eae291a8604e84af8cce45 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Wed, 7 Aug 2024 14:35:03 -0700 Subject: [PATCH] Omit trivial diffs --- cli/src/diff_util.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cli/src/diff_util.rs b/cli/src/diff_util.rs index 698f7b984b..d44cee42f8 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -831,6 +831,19 @@ fn show_structured_conflict_diff_hunks( text = print_context(formatter, text, false)?; } last_hunk_unmodified_text = Some(Some(text)); + } else if explained_hunk.iter().all(|elt| { + matches!( + elt, + DiffExplanationAtom::UnchangedConflictAdd(_) + | DiffExplanationAtom::UnchangedConflictRemove(_) + ) + }) { + // The conflict wasn't modified. + // TODO: Is there a better way to present the unmodified conflict in the + // context? + last_hunk_unmodified_text = Some(Some( + b"<<<<<<< Unmodified conflict (omitted) >>>>>>>".to_vec(), + )); } else if let [DiffExplanationAtom::ChangedConflictAdd { left_version, right_version,