summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5390590)
raw | patch | inline | side by side (parent: 5390590)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 4 Jul 2006 09:43:40 +0000 (02:43 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 4 Jul 2006 10:15:46 +0000 (03:15 -0700) |
Upon hit, we should exit with status 0.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-grep.c | patch | blob | history |
diff --git a/builtin-grep.c b/builtin-grep.c
index a8bec72f82a9cac96b2b46bddb255b8be15cd6d1..bc53546dc713f425e1d35fd3716265a0bdf01702 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
static int external_grep(struct grep_opt *opt, const char **paths, int cached)
{
- int i, nr, argc, hit, len;
+ int i, nr, argc, hit, len, status;
const char *argv[MAXARGS+1];
char randarg[ARGBUF];
char *argptr = randarg;
@@ -536,12 +536,17 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
argv[argc++] = name;
if (argc < MAXARGS)
continue;
- hit += exec_grep(argc, argv);
+ status = exec_grep(argc, argv);
+ if (0 < status)
+ hit = 1;
argc = nr;
}
- if (argc > nr)
- hit += exec_grep(argc, argv);
- return 0;
+ if (argc > nr) {
+ status = exec_grep(argc, argv);
+ if (0 < status)
+ hit = 1;
+ }
+ return hit;
}
static int grep_cache(struct grep_opt *opt, const char **paths, int cached)