Skip to content

Commit

Permalink
grep: fix exit status if external_grep() punts
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Clemens Buchacher authored and Junio C Hamano committed Sep 7, 2009
1 parent e276f01 commit 929e37d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions builtin-grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 929e37d

Please sign in to comment.