summaryrefslogtreecommitdiff
path: root/builtin-grep.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-03-12 17:39:16 -0400
committerJunio C Hamano <gitster@pobox.com>2008-03-13 00:57:53 -0700
commit5f7c643afe8da21c82762f872632d6407530f9e8 (patch)
tree539bc16db70d8fda7ff4cdc4021e247d6df628dd /builtin-grep.c
parentcde2ed25ad764260aaa08a9ed3fbd997723c6b76 (diff)
downloadgit-5f7c643afe8da21c82762f872632d6407530f9e8.tar.gz
add NO_EXTERNAL_GREP build option
Previously, we just chose whether to allow external grep based on the __unix__ define. However, there are systems which define this macro but which have an inferior group (e.g., one that does not support all options used by t7002). This allows users to accept the potential speed penalty to get a more consistent grep experience (and to pass the testsuite). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-grep.c')
-rw-r--r--builtin-grep.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index f4f4ecb11b..ef299108f5 100644
--- a/builtin-grep.c
+++ b/builtin-grep.c
@@ -12,6 +12,14 @@
#include "builtin.h"
#include "grep.h"
+#ifndef NO_EXTERNAL_GREP
+#ifdef __unix__
+#define NO_EXTERNAL_GREP 0
+#else
+#define NO_EXTERNAL_GREP 1
+#endif
+#endif
+
/*
* git grep pathspecs are somewhat different from diff-tree pathspecs;
* pathname wildcards are allowed.
@@ -153,7 +161,7 @@ static int grep_file(struct grep_opt *opt, const char *filename)
return i;
}
-#ifdef __unix__
+#if !NO_EXTERNAL_GREP
static int exec_grep(int argc, const char **argv)
{
pid_t pid;
@@ -372,7 +380,7 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
int nr;
read_cache();
-#ifdef __unix__
+#if !NO_EXTERNAL_GREP
/*
* Use the external "grep" command for the case where
* we grep through the checked-out files. It tends to