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>
Junio C Hamano committed
Apr 18, 2006 at 11:41 UTC
3a624b346db02a07b0317743b362d1a15c6c3c18
2 files changed
+9
-2
diff.c
+9
@@ -1029,6 +1029,15 @@ int diff_setup_done(struct diff_options *options)
1029
options->detect_rename != DIFF_DETECT_COPY) ||
1030
(0 <= options->rename_limit && !options->detect_rename))
1031
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
+
1041
if (options->detect_rename && options->rename_limit < 0)
1042
options->rename_limit = diff_rename_limit_default;
1043
if (options->setup & DIFF_SETUP_USE_CACHE) {
revision.c
-2
@@ -791,8 +791,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
791
if (revs->dense_combined_merges)
792
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
793
}
794
- if (revs->diffopt.output_format == DIFF_FORMAT_PATCH)
795
- revs->diffopt.recursive = 1;
794
revs->diffopt.abbrev = revs->abbrev;
795
diff_setup_done(&revs->diffopt);
796