Browse Source

grep: prefer builtin over external one when coloring results

As far as I know, not all grep programs support coloring, so we should
rely on builtin grep. If you want external grep, set
color.grep.external to empty string.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Nguyễn Thái Ngọc Duy 16 years ago committed by Junio C Hamano
parent
commit
6e89ec0f1e
  1. 2
      builtin-grep.c

2
builtin-grep.c

@ -825,6 +825,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
} }
} }


if (opt.color && !opt.color_external)
builtin_grep = 1;
if (!opt.pattern_list) if (!opt.pattern_list)
die("no pattern given."); die("no pattern given.");
if ((opt.regflags != REG_NEWLINE) && opt.fixed) if ((opt.regflags != REG_NEWLINE) && opt.fixed)

Loading…
Cancel
Save