summaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorClemens Buchacher <drizzd@aon.at>2009-09-07 10:48:01 +0200
committerJunio C Hamano <gitster@pobox.com>2009-09-07 15:02:31 -0700
commit929e37d3dfef13895ef6e4b54c7d45962b234461 (patch)
tree2ec74d98cb597395ead51cf8222f3d294b3f2184 /builtin-grep.c
parente276f018f2c1f0fc962fbe44a36708d1cdebada8 (diff)
downloadgit-929e37d3dfef13895ef6e4b54c7d45962b234461.tar.gz
grep: fix exit status if external_grep() punts
If external_grep() is called and punts, grep_cache() mistakenly reported a hit, even if there were none. The bug can be triggered by calling "git grep --no-color" from a subdirectory. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-grep.c')
-rw-r--r--builtin-grep.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index f88a912ace..da2f4fe1b8 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -448,6 +448,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
hit = external_grep(opt, paths, cached);
if (hit >= 0)
return hit;
+ hit = 0;
}
#endif