Skip to content

Commit

Permalink
grep: prefer builtin over external one when coloring results
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nguyễn Thái Ngọc Duy authored and Junio C Hamano committed Mar 18, 2009
1 parent 747a322 commit 6e89ec0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 6e89ec0

Please sign in to comment.