From 78ba3fcf10cd50292bc4244a5d4a579539eb6d00 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 ce0b72b155..881503b42b 100644 --- a/cli/src/diff_util.rs +++ b/cli/src/diff_util.rs @@ -1043,6 +1043,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,