summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 51a9949)
raw | patch | inline | side by side (parent: 51a9949)
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | |
Thu, 7 May 2009 19:46:17 +0000 (21:46 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 9 May 2009 07:29:53 +0000 (00:29 -0700) |
Replace the only global variable in builtin-grep.c, builtin_grep, by a
local one and a function parameter with reversed meaning.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
local one and a function parameter with reversed meaning.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-grep.c | patch | blob | history |
diff --git a/builtin-grep.c b/builtin-grep.c
index f88a912ace9195c387566770432a904e2d7adcb7..620399f9abb61cca78d3af61cd6f13544d9e09f2 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
#endif
#endif
-static int builtin_grep;
-
static int grep_config(const char *var, const char *value, void *cb)
{
struct grep_opt *opt = cb;
}
#endif
-static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
+static int grep_cache(struct grep_opt *opt, const char **paths, int cached,
+ int external_grep_allowed)
{
int hit = 0;
int nr;
* we grep through the checked-out files. It tends to
* be a lot more optimized
*/
- if (!cached && !builtin_grep) {
+ if (!cached && external_grep_allowed) {
hit = external_grep(opt, paths, cached);
if (hit >= 0)
return hit;
{
int hit = 0;
int cached = 0;
+ int external_grep_allowed = 1;
int seen_dashdash = 0;
struct grep_opt opt;
struct object_array list = { 0, 0, NULL };
continue;
}
if (!strcmp("--no-ext-grep", arg)) {
- builtin_grep = 1;
+ external_grep_allowed = 0;
continue;
}
if (!strcmp("-a", arg) ||
}
if (opt.color && !opt.color_external)
- builtin_grep = 1;
+ external_grep_allowed = 0;
if (!opt.pattern_list)
die("no pattern given.");
if ((opt.regflags != REG_NEWLINE) && opt.fixed)
if (!list.nr) {
if (!cached)
setup_work_tree();
- return !grep_cache(&opt, paths, cached);
+ return !grep_cache(&opt, paths, cached, external_grep_allowed);
}
if (cached)