Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] grep: fix exit status if external_grep() returns error

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:47:22

Clemens Buchacher [off-list ref] writes:
quoted hunk
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help