Skip to content

Commit

Permalink
diff --no-index: Do not generate patch output if other output is requ…
Browse files Browse the repository at this point in the history
…ested

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>
  • Loading branch information
Johannes Sixt authored and Junio C Hamano committed Mar 25, 2009
1 parent 2a5643d commit 5d83f9c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diff-no-index.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,6 @@ void diff_no_index(struct rev_info *revs,
no_index ? "--no-index" : "[--no-index]");

diff_setup(&revs->diffopt);
if (!revs->diffopt.output_format)
revs->diffopt.output_format = DIFF_FORMAT_PATCH;
for (i = 1; i < argc - 2; ) {
int j;
if (!strcmp(argv[i], "--no-index"))
Expand Down Expand Up @@ -248,6 +246,8 @@ void diff_no_index(struct rev_info *revs,
revs->diffopt.paths = argv + argc - 2;
revs->diffopt.nr_paths = 2;
revs->diffopt.skip_stat_unmatch = 1;
if (!revs->diffopt.output_format)
revs->diffopt.output_format = DIFF_FORMAT_PATCH;

DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS);
DIFF_OPT_SET(&revs->diffopt, NO_INDEX);
Expand Down

0 comments on commit 5d83f9c

Please sign in to comment.