summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2011-08-17 22:03:48 -0700
committerJunio C Hamano <gitster@pobox.com>2011-08-18 14:48:29 -0700
commite269eb7946d0a4ba6a4e175133b5479446ac04a5 (patch)
tree65da98cebb4776458fa7944ba7101c2f4149f1f7 /diff.c
parentf1c9626105d5e4962a5ccaa4620114d03f32ad02 (diff)
downloadgit-e269eb7946d0a4ba6a4e175133b5479446ac04a5.tar.gz
git_config_colorbool: refactor stdout_is_tty handling
Usually this function figures out for itself whether stdout is a tty. However, it has an extra parameter just to allow git-config to override the auto-detection for its --get-colorbool option. Instead of an extra parameter, let's just use a global variable. This makes calling easier in the common case, and will make refactoring the colorbool code much simpler. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index cd5ad7525b..1f87f23190 100644
--- a/diff.c
+++ b/diff.c
@@ -137,7 +137,7 @@ static int git_config_rename(const char *var, const char *value)
int git_diff_ui_config(const char *var, const char *value, void *cb)
{
if (!strcmp(var, "diff.color") || !strcmp(var, "color.diff")) {
- diff_use_color_default = git_config_colorbool(var, value, -1);
+ diff_use_color_default = git_config_colorbool(var, value);
return 0;
}
if (!strcmp(var, "diff.renames")) {
@@ -3373,7 +3373,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
else if (!strcmp(arg, "--color"))
options->use_color = 1;
else if (!prefixcmp(arg, "--color=")) {
- int value = git_config_colorbool(NULL, arg+8, -1);
+ int value = git_config_colorbool(NULL, arg+8);
if (value == 0)
options->use_color = 0;
else if (value > 0)