Skip to content

Commit 5d83f9c

Browse files
j6tgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2a5643d commit 5d83f9c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

diff-no-index.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ void diff_no_index(struct rev_info *revs,
201201
no_index ? "--no-index" : "[--no-index]");
202202

203203
diff_setup(&revs->diffopt);
204-
if (!revs->diffopt.output_format)
205-
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
206204
for (i = 1; i < argc - 2; ) {
207205
int j;
208206
if (!strcmp(argv[i], "--no-index"))
@@ -248,6 +246,8 @@ void diff_no_index(struct rev_info *revs,
248246
revs->diffopt.paths = argv + argc - 2;
249247
revs->diffopt.nr_paths = 2;
250248
revs->diffopt.skip_stat_unmatch = 1;
249+
if (!revs->diffopt.output_format)
250+
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
251251

252252
DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
253253
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);

0 commit comments

Comments
 (0)