Skip to content

Commit 4320815

Browse files
sorganovgitster
authored andcommitted
diff-merges: introduce --diff-merges=on
Introduce the notion of default diff format for merges, and the option "on" to select it. The default format is "separate" and can't yet be changed, so effectively "on" is just a synonym for "separate" for now. Add corresponding test to t4013. This is in preparation for introducing log.diffMerges configuration option that will let --diff-merges=on to be configured to any supported format. Signed-off-by: Sergey Organov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 56550ea commit 4320815

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

diff-merges.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
#include "revision.h"
44

5+
typedef void (*diff_merges_setup_func_t)(struct rev_info *);
6+
static void set_separate(struct rev_info *revs);
7+
8+
static diff_merges_setup_func_t set_to_default = set_separate;
9+
510
static void suppress(struct rev_info *revs)
611
{
712
revs->separate_merges = 0;
@@ -66,6 +71,8 @@ static void set_diff_merges(struct rev_info *revs, const char *optarg)
6671
set_combined(revs);
6772
else if (!strcmp(optarg, "cc") || !strcmp(optarg, "dense-combined"))
6873
set_dense_combined(revs);
74+
else if (!strcmp(optarg, "on"))
75+
set_to_default(revs);
6976
else
7077
die(_("unknown value for --diff-merges: %s"), optarg);
7178

t/t4013-diff-various.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,14 @@ diff-tree --stat --compact-summary initial mode
452452
diff-tree -R --stat --compact-summary initial mode
453453
EOF
454454

455+
test_expect_success 'log --diff-merges=on matches --diff-merges=separate' '
456+
git log -p --diff-merges=separate master >result &&
457+
process_diffs result >expected &&
458+
git log -p --diff-merges=on master >result &&
459+
process_diffs result >actual &&
460+
test_cmp expected actual
461+
'
462+
455463
test_expect_success 'log -S requires an argument' '
456464
test_must_fail git log -S
457465
'

0 commit comments

Comments
 (0)