[PATCH 2/2] test-lib-functions: use user's TERM and HOME for 'debug'
- From
Philippe Blain via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Aug 19, 2021, 17:16 UTC
- Message-ID
- <d51d0db6e250c118b2d0f6eff571e1a7642da00e.1629393395.git.gitgitgadget@gmail.com>
- In-Reply-To
- <pull.1022.git.1629393395.gitgitgadget@gmail.com>
From: Philippe Blain <levraiphilippeblain@gmail.com>
The 'debug' function in test-lib-functions.sh is used to invoke a debugger at a specific line in a test. It inherits the value of HOME and TERM set by 'test-lib.sh': HOME="$TRASH_DIRECTORY" and TERM=dumb.
Changing the value of HOME means that any customization configured in a developers' debugger configuration file (like $HOME/.gdbinit or $HOME/.lldbinit) are not available in the debugger invoked by 'test_pause'.
Changing the value of TERM to 'dumb' means that colored output is disabled in the debugger.
To make the debugging experience with 'debug' more pleasant, leverage the variables USER_HOME and USER_TERM, added in the previous commit, to set HOME and TERM before invoking the debugger.
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> --- t/test-lib-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 662cfc4c3e0..86680b1177d 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -163,7 +163,7 @@ debug () { GIT_DEBUGGER=1 ;; esac && - GIT_DEBUGGER="${GIT_DEBUGGER}" "$@" <&6 >&5 2>&7 + TERM="$USER_TERM" HOME="$USER_HOME" GIT_DEBUGGER="${GIT_DEBUGGER}" "$@" <&6 >&5 2>&7 } # Usage: test_commit [options] <message> [<file> [<contents> [<tag>]]]
-- gitgitgadget