git-grep: correct exit code with --quiet and -L

The handling of `status_only` no longer interferes with the handling of `unmatch_name_only`. `--quiet` no longer affects the exit code when using `-L`/`--files-without-match`. Signed-off-by: Anthony Sottile <asottile@umich.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Anthony Sottile committed Aug 17, 2017 at 18:38 UTC e1f68c66d575e09f325f3eda9ced1b2f4ef4b4f0
2 files changed +6 -1
grep.c
+1 -1
@@ -1629,7 +1629,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
1629 return 0;
1630
1631 if (opt->status_only)
1632 - return 0;
1632 + return opt->unmatch_name_only;
1633 if (opt->unmatch_name_only) {
1634 /* We did not see any hit, so we want to show this */
1635 show_name(opt, gs->name);
t/t7810-grep.sh
+5
@@ -370,6 +370,11 @@ test_expect_success 'grep -L -C' '
370 test_cmp expected actual
371 '
372
373 +test_expect_success 'grep --files-without-match --quiet' '
374 + git grep --files-without-match --quiet nonexistent_string >actual &&
375 + test_cmp /dev/null actual
376 +'
377 +
378 cat >expected <<EOF
379 file:foo mmap bar_mmap
380 EOF