Skip to content

Commit 3a624b3

Browse files
author
Junio C Hamano
committed
Fix "git log --stat": make sure to set recursive with --stat.
Just like "patch" format always needs recursive, "diffstat" format does not make sense without setting recursive. Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 965f803 commit 3a624b3

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

diff.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,6 +1029,15 @@ int diff_setup_done(struct diff_options *options)
10291029
options->detect_rename != DIFF_DETECT_COPY) ||
10301030
(0 <= options->rename_limit && !options->detect_rename))
10311031
return -1;
1032+
1033+
/*
1034+
* These cases always need recursive; we do not drop caller-supplied
1035+
* recursive bits for other formats here.
1036+
*/
1037+
if ((options->output_format == DIFF_FORMAT_PATCH) ||
1038+
(options->output_format == DIFF_FORMAT_DIFFSTAT))
1039+
options->recursive = 1;
1040+
10321041
if (options->detect_rename && options->rename_limit < 0)
10331042
options->rename_limit = diff_rename_limit_default;
10341043
if (options->setup & DIFF_SETUP_USE_CACHE) {

revision.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
791791
if (revs->dense_combined_merges)
792792
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
793793
}
794-
if (revs->diffopt.output_format == DIFF_FORMAT_PATCH)
795-
revs->diffopt.recursive = 1;
796794
revs->diffopt.abbrev = revs->abbrev;
797795
diff_setup_done(&revs->diffopt);
798796

0 commit comments

Comments
 (0)