@matheusbsbs / matheus-bagliano / commits / f56ef54174
Fork 0

diff --stat: make sure to set recursive.

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:29 UTC f56ef54174598d5362d0446c5a560cb5892537c2
3 files changed +10 -5
diff-tree.c
-3
@@ -117,9 +117,6 @@ int main(int argc, const char **argv)
117 if (opt->dense_combined_merges)
118 opt->diffopt.output_format = DIFF_FORMAT_PATCH;
119
120 - if (opt->diffopt.output_format == DIFF_FORMAT_PATCH)
121 - opt->diffopt.recursive = 1;
122 -
120 diff_tree_setup_paths(get_pathspec(prefix, argv), &opt->diffopt);
121 diff_setup_done(&opt->diffopt);
122
diff.c
+10
@@ -1029,6 +1029,16 @@ 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->with_stat))
1040 + options->recursive = 1;
1041 +
1042 if (options->detect_rename && options->rename_limit < 0)
1043 options->rename_limit = diff_rename_limit_default;
1044 if (options->setup & DIFF_SETUP_USE_CACHE) {
git.c
-2
@@ -344,8 +344,6 @@ static int cmd_log(int argc, const char **argv, char **envp)
344 opt.ignore_merges = 0;
345 if (opt.dense_combined_merges)
346 opt.diffopt.output_format = DIFF_FORMAT_PATCH;
347 - if (opt.diffopt.output_format == DIFF_FORMAT_PATCH)
348 - opt.diffopt.recursive = 1;
347 if (!full_diff && rev.prune_data)
348 diff_tree_setup_paths(rev.prune_data, &opt.diffopt);
349 diff_setup_done(&opt.diffopt);