summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-03-16 13:20:04 +1100
committerJunio C Hamano <gitster@pobox.com>2009-03-17 17:03:33 -0700
commit6e89ec0f1e716c11bf7fa214b4c7b975ea77c736 (patch)
tree5620001d0f21798e3e2159be19099bdfe02b591c
parent747a322bcc4df5f9a371890ffe728741456704c7 (diff)
downloadgit-6e89ec0f1e716c11bf7fa214b4c7b975ea77c736.tar.gz
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>
-rw-r--r--builtin-grep.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-grep.c b/builtin-grep.c
index 9e7e766a49..89489ddcf8 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)