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>
Clemens Buchacher committed
Sep 7, 2009 at 10:48 UTC
929e37d3dfef13895ef6e4b54c7d45962b234461
1 file changed
+1
builtin-grep.c
+1
@@ -448,6 +448,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
448
hit = external_grep(opt, paths, cached);
449
if (hit >= 0)
450
return hit;
451
+ hit = 0;
452
}
453
#endif
454