summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cde2ed2)
raw | patch | inline | side by side (parent: cde2ed2)
author | Jeff King <peff@peff.net> | |
Wed, 12 Mar 2008 21:39:16 +0000 (17:39 -0400) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 13 Mar 2008 07:57:53 +0000 (00:57 -0700) |
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>
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>
Makefile | patch | blob | history | |
builtin-grep.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index e3eaa6a543e7c3eed8a72c00f8b5541524fc9508..bc46fd44f5b36efe48f43a00631f3a86b924264c 100644 (file)
--- a/Makefile
+++ b/Makefile
# is a simplified version of the merge sort used in glibc. This is
# recommended if Git triggers O(n^2) behavior in your platform's qsort().
#
+# Define NO_EXTERNAL_GREP if you don't want "git grep" to ever call
+# your external grep (e.g., if your system lacks grep, if its grep is
+# broken, or spawning external process is slower than built-in grep git has).
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
@$(SHELL_PATH) ./GIT-VERSION-GEN
ifdef DIR_HAS_BSD_GROUP_SEMANTICS
COMPAT_CFLAGS += -DDIR_HAS_BSD_GROUP_SEMANTICS
endif
+ifdef NO_EXTERNAL_GREP
+ BASIC_CFLAGS += -DNO_EXTERNAL_GREP
+endif
ifeq ($(TCLTK_PATH),)
NO_TCLTK=NoThanks
diff --git a/builtin-grep.c b/builtin-grep.c
index f4f4ecb11b587c74a009c94cb7b230e7c93590e4..ef299108f529fa5fa931d765828f04535c3a6351 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
#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.
return i;
}
-#ifdef __unix__
+#if !NO_EXTERNAL_GREP
static int exec_grep(int argc, const char **argv)
{
pid_t pid;
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