Skip to content

Commit 04b19fc

Browse files
peffgitster
authored andcommitted
combine-diff: treat --summary like --stat
Currently "--cc --summary" on a merge shows nothing. Since we show "--cc --stat" as a stat against the first parent, and because --summary is typically used in combination with --stat, it makes sense to treat them both the same way. Note that we have to tweak t4013's setup a bit to test this case, as the existing merges do not have any --summary results against their first parent. But since the merge at the tip of 'master' does add and remove files with respect to the second parent, we can just make a reversed doppelganger merge where the parents are swapped. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 8290faa commit 04b19fc

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

combine-diff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,6 +1326,7 @@ static const char *path_path(void *obj)
13261326
*/
13271327
#define STAT_FORMAT_MASK (DIFF_FORMAT_NUMSTAT \
13281328
| DIFF_FORMAT_SHORTSTAT \
1329+
| DIFF_FORMAT_SUMMARY \
13291330
| DIFF_FORMAT_DIFFSTAT)
13301331

13311332
/* find set of paths that every parent touches */

t/t4013-diff-various.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ test_expect_success setup '
9898
git commit -m "update mode" &&
9999
git checkout -f master &&
100100
101+
# Same merge as master, but with parents reversed. Hide it in a
102+
# pseudo-ref to avoid impacting tests with --all.
103+
commit=$(echo reverse |
104+
git commit-tree -p master^2 -p master^1 master^{tree}) &&
105+
git update-ref REVERSE $commit &&
106+
101107
git config diff.renames false &&
102108
103109
git show-branch
@@ -240,6 +246,7 @@ diff-tree --cc --stat --summary master
240246
diff-tree -c --stat --summary side
241247
diff-tree --cc --stat --summary side
242248
diff-tree --cc --shortstat master
249+
diff-tree --cc --summary REVERSE
243250
# improved by Timo's patch
244251
diff-tree --cc --patch-with-stat master
245252
# improved by Timo's patch
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
$ git diff-tree --cc --summary REVERSE
2+
2562325a7ee916efb2481da93073b82cec801cbc
3+
create mode 100644 file1
4+
delete mode 100644 file2
5+
delete mode 100644 file3
6+
$

0 commit comments

Comments
 (0)