Skip to content

Commit df58a82

Browse files
committed
diff --quiet: make it synonym to --exit-code >/dev/null
The point of --quiet was to return the status as early as possible without doing any extra processing. Well behaved scripts, when they expect to run many diff operations inside, are supposed to run "update-index --refresh" upfront; we do not want them to pay the price of iterating over the index and comparing the contents to fix the stat dirtiness, and we avoided most of the processing in diffcore_std() when --quiet is in effect. But scripts that adhere to the good practice won't have to pay any more price than the necessary lstat(2) that will report stat cleanliness, as long as only -q is given without any fancier diff options. More importantly, users who do ask for "--quiet -M --filter=D" (in order to notice only the deletion, not paths that disappeared only because they have been renamed away) deserve to get the result they asked for, even it means they have to pay the extra price; the alternative is to get a cheap early return that gives a result they did not ask for, which is much worse. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9d86535 commit df58a82

File tree

1 file changed

+0
-10
lines changed

1 file changed

+0
-10
lines changed

diff.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2393,13 +2393,6 @@ int diff_setup_done(struct diff_options *options)
23932393
DIFF_OPT_SET(options, EXIT_WITH_STATUS);
23942394
}
23952395

2396-
/*
2397-
* If we postprocess in diffcore, we cannot simply return
2398-
* upon the first hit. We need to run diff as usual.
2399-
*/
2400-
if (options->pickaxe || options->filter)
2401-
DIFF_OPT_CLR(options, QUIET);
2402-
24032396
return 0;
24042397
}
24052398

@@ -3391,9 +3384,6 @@ static void diffcore_skip_stat_unmatch(struct diff_options *diffopt)
33913384

33923385
void diffcore_std(struct diff_options *options)
33933386
{
3394-
if (DIFF_OPT_TST(options, QUIET))
3395-
return;
3396-
33973387
if (options->skip_stat_unmatch)
33983388
diffcore_skip_stat_unmatch(options);
33993389
if (options->break_opt != -1)

0 commit comments

Comments
 (0)