From f0d4c36701613dc9c305208d81b139208e40414c Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Fri, 12 Jun 2009 09:33:48 -0700 Subject: [PATCH] grep: Only use --color on git 1.6.3 and later The --color flag wasn't introduced until git 1.6.3. Prior to that version, `git grep --color` just produces a fatal error, as it is an unsupported option. Since this is just pretty output and is not critical to execution, we can simply omit the option if the version of git we are running on doesn't support it. Signed-off-by: Shawn O. Pearce --- subcmds/grep.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subcmds/grep.py b/subcmds/grep.py index 950cc155..4f714271 100644 --- a/subcmds/grep.py +++ b/subcmds/grep.py @@ -17,7 +17,7 @@ import sys from optparse import SUPPRESS_HELP from color import Coloring from command import PagedCommand -from git_command import GitCommand +from git_command import git_require, GitCommand class GrepColoring(Coloring): def __init__(self, config): @@ -158,7 +158,7 @@ contain a line that matches both expressions: out = GrepColoring(self.manifest.manifestProject.config) cmd_argv = ['grep'] - if out.is_on: + if out.is_on and git_require((1,6,3)): cmd_argv.append('--color') cmd_argv.extend(getattr(opt,'cmd_argv',[]))