@matheusbsbs / matheus-bagliano / commits / e78503db16
Fork 0

Revert "builtin-grep: workaround for non GNU grep."

This reverts 518920b764ee9150781e68217181b24d0712748e commit. Linus has a more portable alternative.

Junio C Hamano committed May 17, 2006 at 11:42 UTC e78503db1658ab6650608359cfd8beaf1645239f
2 files changed +3 -30
Makefile
-11
@@ -46,8 +46,6 @@ all:
46 #
47 # Define NO_MMAP if you want to avoid mmap.
48 #
49 -# Define NO_H_OPTION_IN_GREP if your grep does not understand -H.
50 -#
49 # Define WITH_OWN_SUBPROCESS_PY if you want to use with python 2.3.
50 #
51 # Define NO_IPV6 if you lack IPv6 support and getaddrinfo().
@@ -446,12 +444,6 @@ ifdef NO_ACCURATE_DIFF
444 ALL_CFLAGS += -DNO_ACCURATE_DIFF
445 endif
446
449 -ifdef NO_H_OPTION_IN_GREP
450 - NO_H_OPTION_IN_GREP=1
451 -else
452 - NO_H_OPTION_IN_GREP=0
453 -endif
454 -
447 # Shell quote (do not use $(call) to accomodate ancient setups);
448
449 SHA1_HEADER_SQ = $(subst ','\'',$(SHA1_HEADER))
@@ -534,9 +526,6 @@ git$X git.spec \
526 %.o: %.S
527 $(CC) -o $*.o -c $(ALL_CFLAGS) $<
528
537 -builtin-grep.o: builtin-grep.c
538 - $(CC) -o $*.o -c $(ALL_CFLAGS) -DNO_H_OPTION_IN_GREP=$(NO_H_OPTION_IN_GREP) $<
539 -
529 exec_cmd.o: exec_cmd.c
530 $(CC) -o $*.o -c $(ALL_CFLAGS) '-DGIT_EXEC_PATH="$(gitexecdir_SQ)"' $<
531
builtin-grep.c
+3 -19
@@ -453,6 +453,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
453
454 len = nr = 0;
455 push_arg("grep");
456 + push_arg("-H");
457 if (opt->fixed)
458 push_arg("-F");
459 if (opt->linenum)
@@ -502,13 +503,7 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached)
503 push_arg("-e");
504 push_arg(p->pattern);
505 }
505 -
506 - if (NO_H_OPTION_IN_GREP)
507 - push_arg("/dev/null");
508 - else {
509 - push_arg("-H");
510 - push_arg("--");
511 - }
506 + push_arg("--");
507
508 hit = 0;
509 argc = nr;
@@ -540,19 +535,8 @@ static int grep_cache(struct grep_opt *opt, const char **paths, int cached)
535 * Use the external "grep" command for the case where
536 * we grep through the checked-out files. It tends to
537 * be a lot more optimized
543 - *
544 - * Some grep implementations do not understand -H nor --
545 - * but /dev/null can be used as a substitution in most
546 - * cases.
547 - *
548 - * However -L and -c would slightly misbehave (-L would
549 - * list /dev/null as a hit, and -c would report 0 hits
550 - * from /dev/null); so do not use the external one on
551 - * such platforms.
538 */
553 - if (!cached &&
554 - (!NO_H_OPTION_IN_GREP ||
555 - (!opt->count && !opt->unmatch_name_only))) {
539 + if (!cached) {
540 hit = external_grep(opt, paths, cached);
541 if (hit >= 0)
542 return hit;