There is no point in running a pager when --quiet is given, since we are producing no output. The regular diff code path handles this already, because --quiet implies --exit-code, and we check for --exit-code when deciding not to run the pager. However, the "quiet implies exit-code" logic is done in diff_setup_done, and the no-index code path sets up its pager before running diff_setup_done, and misses this case. We can fix this by reordering our initialization. Currently we do: 1. read command line arguments into diff_options 2. Set pager if EXIT_CODE not requested 3. always set EXIT_CODE, since we are emulating traditional diff 4. call diff_setup_done We can fix the problem by moving pager initialization (step 2) after step 4. But step 3 must come after step 2 (since we want to know whether the _user_ requested --exit-code, not whether we turned it on unconditionally). So we must move both. Signed-off-by: Jeff King <peff@xxxxxxxx> --- We could also just check for QUICK in setup_diff_pager, which should be a no-op for the regular diff case. But I think doing things in the same order as regular diff could help prevent similar bugs in the future. diff-no-index.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/diff-no-index.c b/diff-no-index.c index fc1decd..77667b8 100644 --- a/diff-no-index.c +++ b/diff-no-index.c @@ -224,8 +224,6 @@ void diff_no_index(struct rev_info *revs, } } - setup_diff_pager(&revs->diffopt); - if (prefix) { int len = strlen(prefix); const char *paths[3]; @@ -250,13 +248,15 @@ void diff_no_index(struct rev_info *revs, 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); revs->max_count = -2; if (diff_setup_done(&revs->diffopt) < 0) die("diff_setup_done failed"); + setup_diff_pager(&revs->diffopt); + DIFF_OPT_SET(&revs->diffopt, EXIT_WITH_STATUS); + if (queue_diff(&revs->diffopt, revs->diffopt.pathspec.raw[0], revs->diffopt.pathspec.raw[1])) exit(1); -- 1.7.11.rc2.4.g0b9de53 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html