diff --git a/grep.c b/grep.c index 0dbdc1d007..3b29fbde2f 100644 --- a/grep.c +++ b/grep.c @@ -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); diff --git a/t/t7810-grep.sh b/t/t7810-grep.sh index cee42097b0..7395038f7e 100755 --- a/t/t7810-grep.sh +++ b/t/t7810-grep.sh @@ -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 <