test-lib: fix TERM to dumb for test repeatability
Dscho noticed that Term::ReadLine (used by send-email) colorized its output for his TERM settings, inside t9001 tests. Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
79f43f3de8
commit
c2116a1783
@ -3,12 +3,16 @@
|
|||||||
# Copyright (c) 2005 Junio C Hamano
|
# Copyright (c) 2005 Junio C Hamano
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Keep the original TERM for say_color
|
||||||
|
ORIGINAL_TERM=$TERM
|
||||||
|
|
||||||
# For repeatability, reset the environment to known value.
|
# For repeatability, reset the environment to known value.
|
||||||
LANG=C
|
LANG=C
|
||||||
LC_ALL=C
|
LC_ALL=C
|
||||||
PAGER=cat
|
PAGER=cat
|
||||||
TZ=UTC
|
TZ=UTC
|
||||||
export LANG LC_ALL PAGER TZ
|
TERM=dumb
|
||||||
|
export LANG LC_ALL PAGER TERM TZ
|
||||||
EDITOR=:
|
EDITOR=:
|
||||||
VISUAL=:
|
VISUAL=:
|
||||||
unset GIT_EDITOR
|
unset GIT_EDITOR
|
||||||
@ -58,12 +62,14 @@ esac
|
|||||||
# This test checks if command xyzzy does the right thing...
|
# This test checks if command xyzzy does the right thing...
|
||||||
# '
|
# '
|
||||||
# . ./test-lib.sh
|
# . ./test-lib.sh
|
||||||
|
[ "x$ORIGINAL_TERM" != "xdumb" ] && (
|
||||||
[ "x$TERM" != "xdumb" ] &&
|
TERM=$ORIGINAL_TERM &&
|
||||||
[ -t 1 ] &&
|
export TERM &&
|
||||||
tput bold >/dev/null 2>&1 &&
|
[ -t 1 ] &&
|
||||||
tput setaf 1 >/dev/null 2>&1 &&
|
tput bold >/dev/null 2>&1 &&
|
||||||
tput sgr0 >/dev/null 2>&1 &&
|
tput setaf 1 >/dev/null 2>&1 &&
|
||||||
|
tput sgr0 >/dev/null 2>&1
|
||||||
|
) &&
|
||||||
color=t
|
color=t
|
||||||
|
|
||||||
while test "$#" -ne 0
|
while test "$#" -ne 0
|
||||||
@ -91,6 +97,9 @@ done
|
|||||||
|
|
||||||
if test -n "$color"; then
|
if test -n "$color"; then
|
||||||
say_color () {
|
say_color () {
|
||||||
|
(
|
||||||
|
TERM=$ORIGINAL_TERM
|
||||||
|
export TERM
|
||||||
case "$1" in
|
case "$1" in
|
||||||
error) tput bold; tput setaf 1;; # bold red
|
error) tput bold; tput setaf 1;; # bold red
|
||||||
skip) tput bold; tput setaf 2;; # bold green
|
skip) tput bold; tput setaf 2;; # bold green
|
||||||
@ -101,6 +110,7 @@ if test -n "$color"; then
|
|||||||
shift
|
shift
|
||||||
echo "* $*"
|
echo "* $*"
|
||||||
tput sgr0
|
tput sgr0
|
||||||
|
)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
say_color() {
|
say_color() {
|
||||||
|
Loading…
Reference in New Issue
Block a user