grep: use the right index instead of the_index

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Nguyễn Thái Ngọc Duy committed Aug 13, 2018 at 18:14 UTC a4009b0b452550036a5e3dd4712797d14a3284a0
1 file changed +2 -2
builtin/grep.c
+2 -2
@@ -497,7 +497,7 @@ static int grep_cache(struct grep_opt *opt, struct repository *repo,
497 strbuf_addstr(&name, ce->name);
498
499 if (S_ISREG(ce->ce_mode) &&
500 - match_pathspec(&the_index, pathspec, name.buf, name.len, 0, NULL,
500 + match_pathspec(repo->index, pathspec, name.buf, name.len, 0, NULL,
501 S_ISDIR(ce->ce_mode) ||
502 S_ISGITLINK(ce->ce_mode))) {
503 /*
@@ -515,7 +515,7 @@ static int grep_cache(struct grep_opt *opt, struct repository *repo,
515 hit |= grep_file(opt, name.buf);
516 }
517 } else if (recurse_submodules && S_ISGITLINK(ce->ce_mode) &&
518 - submodule_path_match(&the_index, pathspec, name.buf, NULL)) {
518 + submodule_path_match(repo->index, pathspec, name.buf, NULL)) {
519 hit |= grep_submodule(opt, repo, pathspec, NULL, ce->name, ce->name);
520 } else {
521 continue;