From: Nguyễn Thái Ngọc Duy Date: Mon, 16 Mar 2009 02:20:04 +0000 (+1100) Subject: grep: prefer builtin over external one when coloring results X-Git-Tag: v1.6.3-rc0~144^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=6e89ec0f1e716c11bf7fa214b4c7b975ea77c736;p=git.git 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-grep.c b/builtin-grep.c index 9e7e766a4..89489ddcf 100644 --- a/builtin-grep.c +++ b/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) die("no pattern given."); if ((opt.regflags != REG_NEWLINE) && opt.fixed)