summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 518920b)
raw | patch | inline | side by side (parent: 518920b)
author | Junio C Hamano <junkio@cox.net> | |
Wed, 17 May 2006 18:42:14 +0000 (11:42 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 17 May 2006 18:42:14 +0000 (11:42 -0700) |
This reverts 518920b764ee9150781e68217181b24d0712748e commit.
Linus has a more portable alternative.
Linus has a more portable alternative.
Makefile | patch | blob | history | |
builtin-grep.c | patch | blob | history |
diff --git a/Makefile b/Makefile
index c67108d2532ae697bae15dc5d1aed6b3f824add5..9ba608c805e6a9864414a963422094ae010e4a86 100644 (file)
--- a/Makefile
+++ b/Makefile
#
# Define NO_MMAP if you want to avoid mmap.
#
-# Define NO_H_OPTION_IN_GREP if your grep does not understand -H.
-#
# Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
#
# Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
ALL_CFLAGS += -DNO_ACCURATE_DIFF
endif
-ifdef NO_H_OPTION_IN_GREP
- NO_H_OPTION_IN_GREP=1
-else
- NO_H_OPTION_IN_GREP=0
-endif
-
# Shell quote (do not use $(call) to accomodate ancient setups);
SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
%.o: %.S
$(CC) -o $*.o -c $(ALL_CFLAGS) $<
-builtin-grep.o: builtin-grep.c
- $(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_H_OPTION_IN_GREP=$(NO_H_OPTION_IN_GREP) $<
-
exec_cmd.o: exec_cmd.c
$(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
diff --git a/builtin-grep.c b/builtin-grep.c
index 36512d8a17abccb67654b5bcfcd74a441b3e4586..66111de5148c17a156fdbfbc0d92b0c93c2b2c34 100644 (file)
--- a/builtin-grep.c
+++ b/builtin-grep.c
len = nr = 0;
push_arg("grep");
+ push_arg("-H");
if (opt->fixed)
push_arg("-F");
if (opt->linenum)
push_arg("-e");
push_arg(p->pattern);
}
-
- if (NO_H_OPTION_IN_GREP)
- push_arg("/dev/null");
- else {
- push_arg("-H");
- push_arg("--");
- }
+ push_arg("--");
hit = 0;
argc = nr;
* Use the external "grep" command for the case where
* we grep through the checked-out files. It tends to
* be a lot more optimized
- *
- * Some grep implementations do not understand -H nor --
- * but /dev/null can be used as a substitution in most
- * cases.
- *
- * However -L and -c would slightly misbehave (-L would
- * list /dev/null as a hit, and -c would report 0 hits
- * from /dev/null); so do not use the external one on
- * such platforms.
*/
- if (!cached &&
- (!NO_H_OPTION_IN_GREP ||
- (!opt->count && !opt->unmatch_name_only))) {
+ if (!cached) {
hit = external_grep(opt, paths, cached);
if (hit >= 0)
return hit;