From: Junio C Hamano Date: Mon, 07 Sep 2009 18:13:55 GMT Subject: Re: [PATCH] grep: fix exit status if external_grep() returns error Message-ID: <7vskeyvd0c.fsf@alter.siamese.dyndns.org> In-Reply-To: <20090907084801.GB10797@localhost> Clemens Buchacher writes: > diff --git a/builtin-grep.c b/builtin-grep.c > index ad0e0a5..b577738 100644 > --- a/builtin-grep.c > +++ b/builtin-grep.c > @@ -500,9 +500,9 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached, > * be a lot more optimized > */ > if (!cached && external_grep_allowed) { > - hit = external_grep(opt, paths, cached); > - if (hit >= 0) > - return hit; > + int ret = external_grep(opt, paths, cached); > + if (ret >= 0) > + return ret; Well caught, and this deserves to go to maint. An alternative would be to reset hit to zero if we decide to use the internal one after this conditional. Thanks.