summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-08 00:48:02 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-08 00:48:02 (GMT)
commita0c2089c1d48dc9969822126170d35c6e5aa141f (patch)
tree13386300f39d2409ceeadc3a42ba2ee9baf4a35c /diff.c
parent6bdca8905764affcab0c92a60a6a319080d76652 (diff)
downloadgit-a0c2089c1d48dc9969822126170d35c6e5aa141f.zip
git-a0c2089c1d48dc9969822126170d35c6e5aa141f.tar.gz
git-a0c2089c1d48dc9969822126170d35c6e5aa141f.tar.bz2
colored diff: diff.color = auto fix
Even if the standard output is connected to a tty, do not colorize the diff if we are talking to a dumb terminal when diff.color configuration variable is set to "auto". Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/diff.c b/diff.c
index f0450a8..aab246c 100644
--- a/diff.c
+++ b/diff.c
@@ -110,8 +110,14 @@ int git_diff_config(const char *var, const char *value)
if (!strcmp(var, "diff.color")) {
if (!value)
diff_use_color_default = 1; /* bool */
- else if (!strcasecmp(value, "auto"))
- diff_use_color_default = isatty(1);
+ else if (!strcasecmp(value, "auto")) {
+ diff_use_color_default = 0;
+ if (isatty(1)) {
+ char *term = getenv("TERM");
+ if (term && strcmp(term, "dumb"))
+ diff_use_color_default = 1;
+ }
+ }
else if (!strcasecmp(value, "never"))
diff_use_color_default = 0;
else if (!strcasecmp(value, "always"))