summaryrefslogtreecommitdiff
path: root/builtin/grep.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-08-18 05:05:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-08-19 22:51:38 (GMT)
commitc9bfb953489e559d513c1627150aa16f8d42d6c5 (patch)
tree2c12de73bcf6ecdb5f2c28aff6cbb3aba91f182a /builtin/grep.c
parent3e1dd17a8958cc5fe47a7ca01c9da8f6fae9cb0b (diff)
downloadgit-c9bfb953489e559d513c1627150aa16f8d42d6c5.zip
git-c9bfb953489e559d513c1627150aa16f8d42d6c5.tar.gz
git-c9bfb953489e559d513c1627150aa16f8d42d6c5.tar.bz2
want_color: automatically fallback to color.ui
All of the "do we want color" flags default to -1 to indicate that we don't have any color configured. This value is handled in one of two ways: 1. In porcelain, we check early on whether the value is still -1 after reading the config, and set it to the value of color.ui (which defaults to 0). 2. In plumbing, it stays untouched as -1, and want_color defaults it to off. This works fine, but means that every porcelain has to check and reassign its color flag. Now that want_color gives us a place to put this check in a single spot, we can do that, simplifying the calling code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/grep.c')
-rw-r--r--builtin/grep.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/builtin/grep.c b/builtin/grep.c
index c17d7de..18522ca 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -883,8 +883,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
strcpy(opt.color_sep, GIT_COLOR_CYAN);
opt.color = -1;
git_config(grep_config, &opt);
- if (opt.color == -1)
- opt.color = git_use_color_default;
/*
* If there is no -- then the paths must exist in the working