mirror of
https://https.git.savannah.gnu.org/git/diffutils.git
synced 2026-01-27 09:54:25 +00:00
diff: disable colorization for TERM=dumb
* src/diff.c (main): With --color or --color=auto, when TERM is "dumb", disable colorization. Suggested by Daniel Colascione. * NEWS (Bug fixes): Mention it. * tests/colors: Add a test that would fail without this change, yet passes with it.
This commit is contained in:
parent
0936993252
commit
697c1f4fa9
4
NEWS
4
NEWS
@ -2,6 +2,10 @@ GNU diffutils NEWS -*- outline -*-
|
||||
|
||||
* Noteworthy changes in release ?.? (????-??-??) [?]
|
||||
|
||||
** Bug fixes
|
||||
|
||||
diff --color no longer colorizes when TERM=dumb
|
||||
|
||||
|
||||
* Noteworthy changes in release 3.4 (2016-08-08) [stable]
|
||||
|
||||
|
||||
@ -656,6 +656,13 @@ main (int argc, char **argv)
|
||||
prev = c;
|
||||
}
|
||||
|
||||
if (colors_style == AUTO)
|
||||
{
|
||||
char const *t = getenv ("TERM");
|
||||
if (t && STREQ (t, "dumb"))
|
||||
colors_style = NEVER;
|
||||
}
|
||||
|
||||
if (output_style == OUTPUT_UNSPECIFIED)
|
||||
{
|
||||
if (show_c_function)
|
||||
|
||||
@ -86,6 +86,11 @@ test $? = 1 || fail=1
|
||||
gen_exp_default > exp || framework_failure_
|
||||
compare exp out || fail=1
|
||||
|
||||
TERM=dumb diff ---presume-output-tty --color=auto a b > out
|
||||
test $? = 1 || fail=1
|
||||
gen_exp_default > exp || framework_failure_
|
||||
compare exp out || fail=1
|
||||
|
||||
diff --color=never a b > out
|
||||
test $? = 1 || fail=1
|
||||
gen_exp_default > exp || framework_failure_
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user