Skip to content

Commit 929e37d

Browse files
Clemens Buchachergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e276f01 commit 929e37d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

builtin-grep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
448448
hit = external_grep(opt, paths, cached);
449449
if (hit >= 0)
450450
return hit;
451+
hit = 0;
451452
}
452453
#endif
453454

0 commit comments

Comments
 (0)