From: Philippe Blain <levraiphilippeblain@xxxxxxxxx> The 'test_pause' function, which is designed to help interactive debugging and exploration of tests, currently inherits the value of HOME and TERM set by 'test-lib.sh': HOME="$TRASH_DIRECTORY" and TERM=dumb. It also invokes the shell defined by SHELL_PATH, which defaults to /bin/sh. Changing the value of HOME means that any customization configured in a developers' shell startup files and any Git aliases defined in their global Git configuration file are not available in the shell invoked by 'test_pause'. Changing the value of TERM to 'dumb' means that colored output is disabled for all commands in that shell. Using /bin/sh as the shell invoked by 'test_pause' is not ideal since some platforms (i.e. Debian and derivatives) use Dash as /bin/sh, and this shell is usually compiled without readline support, which makes for a poor interactive command line experience. To make the interactive command line experience in the shell invoked by 'test_pause' more pleasant, save the values of HOME and TERM in USER_HOME and USER_TERM before changing them in test-lib.sh, and use these variables to invoke the shell in 'test_pause'. Also, invoke SHELL instead of SHELL_PATH, so that developer's interactive shell is used. Signed-off-by: Philippe Blain <levraiphilippeblain@xxxxxxxxx> --- t/test-lib-functions.sh | 2 +- t/test-lib.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index e28411bb75a..662cfc4c3e0 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -139,7 +139,7 @@ test_tick () { # Be sure to remove all invocations of this command before submitting. test_pause () { - "$SHELL_PATH" <&6 >&5 2>&7 + TERM="$USER_TERM" HOME="$USER_HOME" "$SHELL" <&6 >&5 2>&7 } # Wrap git with a debugger. Adding this to a command can make it easier diff --git a/t/test-lib.sh b/t/test-lib.sh index abcfbed6d61..132618991e2 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -585,8 +585,9 @@ else } fi +USER_TERM="$TERM" TERM=dumb -export TERM +export TERM USER_TERM error () { say_color error "error: $*" @@ -1380,9 +1381,10 @@ then fi # Last-minute variable setup +USER_HOME="$HOME" HOME="$TRASH_DIRECTORY" GNUPGHOME="$HOME/gnupg-home-not-used" -export HOME GNUPGHOME +export HOME GNUPGHOME USER_HOME # Test repository rm -fr "$TRASH_DIRECTORY" || { -- gitgitgadget