]> git.ipfire.org Git - thirdparty/git.git/commitdiff
grep: fix exit status if external_grep() punts
authorClemens Buchacher <drizzd@aon.at>
Mon, 7 Sep 2009 08:48:01 +0000 (10:48 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Sep 2009 22:02:31 +0000 (15:02 -0700)
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>
builtin-grep.c

index f88a912ace9195c387566770432a904e2d7adcb7..da2f4fe1b85099fdce09d74062d4c700b3403fa3 100644 (file)
@@ -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