diff options
author | Junio C Hamano <junkio@cox.net> | 2006-05-17 11:42:14 -0700 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-05-17 11:42:14 -0700 |
commit | e78503db1658ab6650608359cfd8beaf1645239f (patch) | |
tree | 8bb22c22192989d31b4faa955883e9a97c9546b4 | |
parent | 518920b764ee9150781e68217181b24d0712748e (diff) | |
download | git-e78503db1658ab6650608359cfd8beaf1645239f.tar.gz git-e78503db1658ab6650608359cfd8beaf1645239f.tar.xz |
Revert "builtin-grep: workaround for non GNU grep."
This reverts 518920b764ee9150781e68217181b24d0712748e commit.
Linus has a more portable alternative.
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | builtin-grep.c | 22 |
2 files changed, 3 insertions, 30 deletions
@@ -46,8 +46,6 @@ all: # # 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(). @@ -446,12 +444,6 @@ ifdef NO_ACCURATE_DIFF 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)) @@ -534,9 +526,6 @@ git$X git.spec \ %.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 36512d8a1..66111de51 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -453,6 +453,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached) len = nr = 0; push_arg("grep"); + push_arg("-H"); if (opt->fixed) push_arg("-F"); if (opt->linenum) @@ -502,13 +503,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached) 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; @@ -540,19 +535,8 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached) * 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; |