combine-diff: treat --dirstat like --stat

Currently "--cc --dirstat" will show nothing for a merge. Like --shortstat and --summary in the previous two patches, it probably makes sense to treat it like we do --stat, and show a stat against the first-parent. This case is less obviously correct than for --shortstat and --summary, as those are basically variants of --stat themselves. It's possible we could develop a multi-parent combined dirstat format, in which case we might regret defining this first-parent behavior. But the same could be said for --stat, and in the 12+ years of it showing first-parent stats, nobody has complained. So showing the first-parent dirstat is at least _useful_, and if we later develop a clever multi-parent stat format, we'd probably have to deal with --stat anyway. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jan 24, 2019 at 07:36 UTC dac03b5518a053e52ed7ee20925970728d3ae4c3
3 files changed +5
combine-diff.c
+1
@@ -1327,6 +1327,7 @@ static const char *path_path(void *obj)
1327 #define STAT_FORMAT_MASK (DIFF_FORMAT_NUMSTAT \
1328 | DIFF_FORMAT_SHORTSTAT \
1329 | DIFF_FORMAT_SUMMARY \
1330 + | DIFF_FORMAT_DIRSTAT \
1331 | DIFF_FORMAT_DIFFSTAT)
1332
1333 /* find set of paths that every parent touches */
t/t4013-diff-various.sh
+1
@@ -358,6 +358,7 @@ diff --line-prefix=abc master master^ side
358 diff --dirstat master~1 master~2
359 diff --dirstat initial rearrange
360 diff --dirstat-by-file initial rearrange
361 +diff --dirstat --cc master~1 master
362 # No-index --abbrev and --no-abbrev
363 diff --raw initial
364 :noellipses diff --raw initial
t/t4013/diff.diff_--dirstat_--cc_master~1_master new
+3
@@ -0,0 +1,3 @@
1 +$ git diff --dirstat --cc master~1 master
2 + 40.0% dir/
3 +$