summaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-12-05 16:13:08 -0800
committerJunio C Hamano <gitster@pobox.com>2007-12-05 16:16:40 -0800
commit6326cee51b21d67e1335ead285cb52b83234b2b4 (patch)
tree430242cddae40db0ccf61506fcdce5cca3656d57 /builtin-grep.c
parent9d25acc49a98ca82988ad871753a45e41f3c90f5 (diff)
downloadgit-6326cee51b21d67e1335ead285cb52b83234b2b4.tar.gz
git grep shows the same hit repeatedly for unmerged paths
When the index is unmerged, e.g. $ git ls-files -u 100644 faf413748eb6ccb15161a212156c5e348302b1b6 1 setup.c 100644 145eca50f41d811c4c8fcb21ed2604e6b2971aba 2 setup.c 100644 cb9558c49b6027bf225ba2a6154c4d2a52bcdbe2 3 setup.c running "git grep" for work tree files repeats hits for each unmerged stage. $ git grep -n -e setup_work_tree -- '*.[ch]' setup.c:209:void setup_work_tree(void) setup.c:209:void setup_work_tree(void) setup.c:209:void setup_work_tree(void) This should fix it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-grep.c')
-rw-r--r--builtin-grep.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index bbf747fc7b..f1ff8dc556 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -343,12 +343,12 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
memcpy(name + 2, ce->name, len + 1);
}
argv[argc++] = name;
- if (argc < MAXARGS)
- continue;
- status = flush_grep(opt, argc, nr, argv, &kept);
- if (0 < status)
- hit = 1;
- argc = nr + kept;
+ if (MAXARGS <= argc) {
+ status = flush_grep(opt, argc, nr, argv, &kept);
+ if (0 < status)
+ hit = 1;
+ argc = nr + kept;
+ }
if (ce_stage(ce)) {
do {
i++;