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 145eca50f4 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>
This commit is contained in:
Junio C Hamano 2007-12-05 16:13:08 -08:00
Родитель 9d25acc49a
Коммит 6326cee51b
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -343,12 +343,12 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
memcpy(name + 2, ce->name, len + 1); memcpy(name + 2, ce->name, len + 1);
} }
argv[argc++] = name; argv[argc++] = name;
if (argc < MAXARGS) if (MAXARGS <= argc) {
continue; status = flush_grep(opt, argc, nr, argv, &kept);
status = flush_grep(opt, argc, nr, argv, &kept); if (0 < status)
if (0 < status) hit = 1;
hit = 1; argc = nr + kept;
argc = nr + kept; }
if (ce_stage(ce)) { if (ce_stage(ce)) {
do { do {
i++; i++;