From b48275998399561780af85d429da3caceeecd2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sun, 22 Nov 2009 16:58:09 +0100 Subject: grep: unset GREP_OPTIONS before spawning external grep While we're at it, also unset GREP_COLOR and GREP_COLORS in case colouring is not enabled, to be on the safe side. The presence of these variables alone is not sufficient to trigger coloured output with GNU grep, but other implementations may behave differently. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- builtin-grep.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'builtin-grep.c') diff --git a/builtin-grep.c b/builtin-grep.c index 01be9bf7ff..9a9e3fccd5 100644 --- a/builtin-grep.c +++ b/builtin-grep.c @@ -433,7 +433,11 @@ static int external_grep(struct grep_opt *opt, const char **paths, int cached) if (opt->color_external && strlen(opt->color_external) > 0) push_arg(opt->color_external); + } else { + unsetenv("GREP_COLOR"); + unsetenv("GREP_COLORS"); } + unsetenv("GREP_OPTIONS"); hit = 0; argc = nr; -- cgit v1.2.1