summary refs log tree commit diff
path: root/diff-merges.c
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2022-02-02 02:37:37 +0000
committerJunio C Hamano <gitster@pobox.com>2022-02-02 10:02:28 -0800
commit0dec322d31db3920872f43bdd2a7ddd282a5be67 (patch)
tree7f10496966f7c05481bf4a53bdbb30ea84d80d06 /diff-merges.c
parent0d83d8240ddb3f54da44563b73527dbc50c4ed22 (diff)
diff-merges: avoid history simplifications when diffing merges
Doing diffs for merges are special; they should typically avoid history
simplification.  For example, with

    git log --diff-merges=first-parent -- path

the default history simplification would remove merge commits from
consideration if the file "path" matched the second parent.  That is
counter to what the user wants when looking for first-parent diffs.
Similar comments can be made for --diff-merges=separate (which diffs
against both parents) and --diff-merges=remerge (which diffs against a
remerge of the merge commit).

However, history simplification still makes sense if not doing diffing
merges, and it also makes sense for the combined and dense-combined
forms of diffing merges (because both of those are defined to only show
a diff when the merge result at the relevant paths differs from *both*
parents).

So, for separate, first-parent, and remerge styles of diff-merges, turn
off history simplification.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-merges.c')
-rw-r--r--diff-merges.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/diff-merges.c b/diff-merges.c
index 0af4b3f919..a833fd747a 100644
--- a/diff-merges.c
+++ b/diff-merges.c
@@ -24,6 +24,7 @@ static void set_separate(struct rev_info *revs)
 {
 	suppress(revs);
 	revs->separate_merges = 1;
+	revs->simplify_history = 0;
 }
 
 static void set_first_parent(struct rev_info *revs)
@@ -50,6 +51,7 @@ static void set_remerge_diff(struct rev_info *revs)
 {
 	suppress(revs);
 	revs->remerge_diff = 1;
+	revs->simplify_history = 0;
 }
 
 static diff_merges_setup_func_t func_by_opt(const char *optarg)