grep: do not diagnose misspelt revs with --no-index

If we are using --no-index, then our arguments cannot be
revs in the first place. Not only is it pointless to
diagnose them, but if we are not in a repository, we should
not be trying to resolve any names.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Jeff King
2017-02-14 01:08:09 -05:00
committed by Junio C Hamano
parent d0ffc06933
commit 73fc7b6b9b
2 changed files with 6 additions and 1 deletions

View File

@ -1201,7 +1201,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
if (!seen_dashdash) {
int j;
for (j = i; j < argc; j++)
verify_filename(prefix, argv[j], j == i);
verify_filename(prefix, argv[j], j == i && use_index);
}
parse_pathspec(&pathspec, 0,