From: Clemens Buchacher Date: Mon, 7 Sep 2009 08:48:01 +0000 (+0200) Subject: grep: fix exit status if external_grep() punts X-Git-Tag: v1.6.4.3~2^2~1 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/929e37d3dfef13895ef6e4b54c7d45962b234461 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 --- 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