From 929e37d3dfef13895ef6e4b54c7d45962b234461 Mon Sep 17 00:00:00 2001 From: Clemens Buchacher Date: Mon, 7 Sep 2009 10:48:01 +0200 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- builtin-grep.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin-grep.c b/builtin-grep.c index f88a912ac..da2f4fe1b 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 -- 2.26.2