Skip to content

Commit 6e89ec0

Browse files
pcloudsgitster
authored andcommitted
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>
1 parent 747a322 commit 6e89ec0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-grep.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
825825
}
826826
}
827827

828+
if (opt.color && !opt.color_external)
829+
builtin_grep = 1;
828830
if (!opt.pattern_list)
829831
die("no pattern given.");
830832
if ((opt.regflags != REG_NEWLINE) && opt.fixed)

0 commit comments

Comments
 (0)