diff --no-index: Do not generate patch output if other output is requested
Previously, 'git diff --no-index --stat a b' generated patch output in addition to the --stat output (or whatever other output format was requested). Now only the requested output is generated, and patch output remains the default. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Sixt committed
Mar 25, 2009 at 18:19 UTC
5d83f9c19810229bb765ef63864e4f252e83ad61
1 file changed
+2
-2
diff-no-index.c
+2
-2
@@ -201,8 +201,6 @@ void diff_no_index(struct rev_info *revs,
201
no_index ? "--no-index" : "[--no-index]");
202
203
diff_setup(&revs->diffopt);
204
- if (!revs->diffopt.output_format)
205
- revs->diffopt.output_format = DIFF_FORMAT_PATCH;
204
for (i = 1; i < argc - 2; ) {
205
int j;
206
if (!strcmp(argv[i], "--no-index"))
@@ -248,6 +246,8 @@ void diff_no_index(struct rev_info *revs,
246
revs->diffopt.paths = argv + argc - 2;
247
revs->diffopt.nr_paths = 2;
248
revs->diffopt.skip_stat_unmatch = 1;
249
+ if (!revs->diffopt.output_format)
250
+ revs->diffopt.output_format = DIFF_FORMAT_PATCH;
251
252
DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
253
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);