summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-10 17:02:55 +0900
committerJunio C Hamano <gitster@pobox.com>2017-09-10 17:02:55 +0900
commitf1b64e8e649566971a4b55122d72f0f1d07047d1 (patch)
tree053ed101439b96a47adf086bb6210931cb179660
parent8388f986b6ff1335f8040418579c4365a4c210f2 (diff)
parente1f68c66d575e09f325f3eda9ced1b2f4ef4b4f0 (diff)
downloadgit-f1b64e8e649566971a4b55122d72f0f1d07047d1.tar.gz
Merge branch 'as/grep-quiet-no-match-exit-code-fix' into maint
"git grep -L" and "git grep --quiet -L" reported different exit codes; this has been corrected. * as/grep-quiet-no-match-exit-code-fix: git-grep: correct exit code with --quiet and -L
-rw-r--r--grep.c2
-rwxr-xr-xt/t7810-grep.sh5
2 files changed, 6 insertions, 1 deletions
diff --git a/grep.c b/grep.c
index 2efec0e182..c9e7cc7356 100644
--- a/grep.c
+++ b/grep.c
@@ -1821,7 +1821,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 f106387820..2a6679c2f5 100755
--- a/t/t7810-grep.sh
+++ b/t/t7810-grep.sh
@@ -374,6 +374,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