From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Cc: Jonathan Nieder <jrnieder@gmail.com>, Jeff King <peff@peff.net>
Subject: [PATCH 1/2] Revert "color: check color.ui in git_default_config()"
Date: Tue, 3 Oct 2017 13:07:36 +0900 [thread overview]
Message-ID: <20171003040737.2336-2-gitster@pobox.com> (raw)
In-Reply-To: <20171003040737.2336-1-gitster@pobox.com>
This reverts commit 136c8c8b8fa39f1315713248473dececf20f8fe7.
Even though we do want to fix the fallout from 4c7f1819 ("make
color.ui default to 'auto'", 2013-06-10), which made it impossible
to override it with "git -c color.ui={never,always} $plumbing",
allowing the plumbing commands to pay attention to color.ui
configuration variable turned out to be an unsatisfactory fix.
People who had color.ui=always, thinking that it should be safe to
do, because it won't apply to plumbing commands, got burned by it.
A bit of fix-up patches are needed, as the series that included the
patch being reverted, and changes after the series landed, have
and/or added code that assumes git_default_config() would read the
color.ui, and they need to be adjusted.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
builtin/branch.c | 2 +-
builtin/clean.c | 3 ++-
builtin/grep.c | 2 +-
builtin/show-branch.c | 2 +-
color.c | 8 ++++++++
config.c | 4 ----
diff.c | 3 +++
7 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 16d391b407..1969c7116c 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -92,7 +92,7 @@ static int git_branch_config(const char *var, const char *value, void *cb)
return config_error_nonbool(var);
return color_parse(value, branch_colors[slot]);
}
- return git_default_config(var, value, cb);
+ return git_color_default_config(var, value, cb);
}
static const char *branch_get_color(enum color_branch ix)
diff --git a/builtin/clean.c b/builtin/clean.c
index c1bafda5b6..057fc97fe4 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -125,7 +125,8 @@ static int git_clean_config(const char *var, const char *value, void *cb)
return 0;
}
- return git_default_config(var, value, cb);
+ /* inspect the color.ui config variable and others */
+ return git_color_default_config(var, value, cb);
}
static const char *clean_get_color(enum color_clean ix)
diff --git a/builtin/grep.c b/builtin/grep.c
index a7157f5632..0d6e669732 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -284,7 +284,7 @@ static int wait_all(void)
static int grep_cmd_config(const char *var, const char *value, void *cb)
{
int st = grep_config(var, value, cb);
- if (git_default_config(var, value, cb) < 0)
+ if (git_color_default_config(var, value, cb) < 0)
st = -1;
if (!strcmp(var, "grep.threads")) {
diff --git a/builtin/show-branch.c b/builtin/show-branch.c
index 28f245c8cc..7073a3eb97 100644
--- a/builtin/show-branch.c
+++ b/builtin/show-branch.c
@@ -554,7 +554,7 @@ static int git_show_branch_config(const char *var, const char *value, void *cb)
return 0;
}
- return git_default_config(var, value, cb);
+ return git_color_default_config(var, value, cb);
}
static int omit_in_dense(struct commit *commit, struct commit **rev, int n)
diff --git a/color.c b/color.c
index 7aa8b076f0..31b6207a00 100644
--- a/color.c
+++ b/color.c
@@ -361,6 +361,14 @@ int git_color_config(const char *var, const char *value, void *cb)
return 0;
}
+int git_color_default_config(const char *var, const char *value, void *cb)
+{
+ if (git_color_config(var, value, cb) < 0)
+ return -1;
+
+ return git_default_config(var, value, cb);
+}
+
void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb)
{
if (*color)
diff --git a/config.c b/config.c
index bc290e7563..a9356c1383 100644
--- a/config.c
+++ b/config.c
@@ -16,7 +16,6 @@
#include "string-list.h"
#include "utf8.h"
#include "dir.h"
-#include "color.h"
struct config_source {
struct config_source *prev;
@@ -1351,9 +1350,6 @@ int git_default_config(const char *var, const char *value, void *dummy)
if (starts_with(var, "advice."))
return git_default_advice_config(var, value);
- if (git_color_config(var, value, dummy) < 0)
- return -1;
-
if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) {
pager_use_color = git_config_bool(var,value);
return 0;
diff --git a/diff.c b/diff.c
index 9c38258030..85e714f6c6 100644
--- a/diff.c
+++ b/diff.c
@@ -299,6 +299,9 @@ int git_diff_ui_config(const char *var, const char *value, void *cb)
return 0;
}
+ if (git_color_config(var, value, cb) < 0)
+ return -1;
+
return git_diff_basic_config(var, value, cb);
}
--
2.14.2-882-gfe33df219d
next prev parent reply other threads:[~2017-10-03 4:07 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-27 13:23 Updated to v2.14.2 on macOS; git add --patch broken Toni Uebernickel
2017-09-27 17:07 ` Jeff King
2017-09-27 17:28 ` Toni Uebernickel
2017-09-27 18:01 ` Jeff King
2017-09-27 19:51 ` Jonathan Nieder
2017-09-27 19:53 ` Jonathan Nieder
2017-09-28 5:03 ` Toni Uebernickel
2017-09-28 5:20 ` Jeff King
2017-09-28 5:31 ` Toni Uebernickel
2017-10-02 23:00 ` Jonathan Nieder
2017-10-03 1:18 ` Junio C Hamano
2017-10-03 2:25 ` Junio C Hamano
2017-10-03 3:14 ` Junio C Hamano
2017-10-03 6:15 ` Jeff King
2017-10-03 7:10 ` Junio C Hamano
2017-10-03 7:16 ` Jeff King
2017-10-03 8:34 ` Junio C Hamano
2017-10-03 8:45 ` Jeff King
2017-10-03 8:56 ` Junio C Hamano
2017-10-03 9:10 ` Jeff King
2017-10-03 9:18 ` Tsvi Mostovicz
2017-10-03 10:38 ` Junio C Hamano
2017-10-03 13:37 ` Jeff King
2017-10-03 13:39 ` [PATCH 01/12] test-terminal: set TERM=vt100 Jeff King
2017-10-03 13:40 ` [PATCH 02/12] t4015: prefer --color to -c color.diff=always Jeff King
2017-10-03 13:41 ` [PATCH 03/12] t4015: use --color with --color-moved Jeff King
2017-10-03 13:42 ` [PATCH 04/12] t3701: use test-terminal to collect color output Jeff King
2017-10-03 13:43 ` [PATCH 05/12] t7508: use test_terminal for " Jeff King
2017-10-03 13:43 ` [PATCH 06/12] t7502: use diff.noprefix for --verbose test Jeff King
2017-10-03 13:44 ` [PATCH 07/12] t6006: drop "always" color config tests Jeff King
2017-10-03 13:44 ` [PATCH 08/12] t3203: drop "always" color test Jeff King
2017-10-03 13:44 ` [PATCH 09/12] t7301: use test_terminal to check color Jeff King
2017-10-03 13:45 ` [PATCH 10/12] t3205: use --color instead of color.branch=always Jeff King
2017-10-03 13:45 ` [PATCH 11/12] provide --color option for all ref-filter users Jeff King
2017-10-03 13:46 ` [PATCH 12/12] color: make "always" the same as "auto" in config Jeff King
2017-10-04 2:59 ` Updated to v2.14.2 on macOS; git add --patch broken Junio C Hamano
2017-10-05 10:06 ` Jeff King
2017-10-20 13:31 ` Jan Prachař
2017-10-03 9:31 ` Jeff King
2017-10-03 4:07 ` [PATCH 0/2] fixing "add -p" regression Junio C Hamano
2017-10-03 4:07 ` Junio C Hamano [this message]
2017-10-03 4:07 ` [PATCH 2/2] colors: git_default_config() does not read color.ui Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171003040737.2336-2-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.