1
0
mirror of https://github.com/git/git synced 2024-07-02 15:48:44 +00:00

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>
This commit is contained in:
Anthony Sottile 2017-08-17 18:38:51 -07:00 committed by Junio C Hamano
parent 3d9c5b5c44
commit e1f68c66d5
2 changed files with 6 additions and 1 deletions

2
grep.c
View File

@ -1629,7 +1629,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
return 0;
if (opt->status_only)
return 0;
return opt->unmatch_name_only;
if (opt->unmatch_name_only) {
/* We did not see any hit, so we want to show this */
show_name(opt, gs->name);

View File

@ -370,6 +370,11 @@ test_expect_success 'grep -L -C' '
test_cmp expected actual
'
test_expect_success 'grep --files-without-match --quiet' '
git grep --files-without-match --quiet nonexistent_string >actual &&
test_cmp /dev/null actual
'
cat >expected <<EOF
file:foo mmap bar_mmap
EOF