diff options
Diffstat (limited to 'builtin/grep.c')
-rw-r--r-- | builtin/grep.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/builtin/grep.c b/builtin/grep.c index d04f4400d9..f8ed4f4182 100644 --- a/builtin/grep.c +++ b/builtin/grep.c @@ -770,9 +770,15 @@ int cmd_grep(int argc, const char **argv, const char *prefix) PARSE_OPT_NO_INTERNAL_HELP); grep_commit_pattern_type(pattern_type_arg, &opt); - if (use_index && !startup_info->have_repository) - /* die the same way as if we did it at the beginning */ - setup_git_directory(); + if (use_index && !startup_info->have_repository) { + int fallback = 0; + git_config_get_bool("grep.fallbacktonoindex", &fallback); + if (fallback) + use_index = 0; + else + /* die the same way as if we did it at the beginning */ + setup_git_directory(); + } /* * skip a -- separator; we know it cannot be |