From: Jeff King Date: Tue, 12 Jan 2016 12:11:07 GMT Subject: Re: [PATCH v4 2/2] builtin/grep: add grep.fallbackToNoIndex config Message-ID: <20160112121106.GA18512@sigill.intra.peff.net> In-Reply-To: <1452595226-14616-3-git-send-email-t.gummerer@gmail.com> On Tue, Jan 12, 2016 at 11:40:26AM +0100, Thomas Gummerer wrote: > diff --git a/builtin/grep.c b/builtin/grep.c > index 4229cae..6b7add6 100644 > --- a/builtin/grep.c > +++ b/builtin/grep.c > @@ -755,9 +755,15 @@ int cmd_grep(int argc, const char **argv, const char *prefix) > PARSE_OPT_STOP_AT_NON_OPTION); > 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 Nice. This turned out delightfully simple. -Peff