From 6a94088cc3d539bdc15b824befc083f7ff8d0288 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 30 Oct 2015 12:02:56 -0700 Subject: test: facilitate debugging Git executables in tests with gdb When prefixing a Git call in the test suite with 'debug ', it will now be run with GDB, allowing the developer to debug test failures more conveniently. Signed-off-by: Johannes Schindelin Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- t/test-lib-functions.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't/test-lib-functions.sh') diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh index 6dffb8bcde..73e37a1f6c 100644 --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@ -145,6 +145,14 @@ test_pause () { fi } +# Wrap git in gdb. Adding this to a command can make it easier to +# understand what is going on in a failing test. +# +# Example: "debug git checkout master". +debug () { + GIT_TEST_GDB=1 "$@" +} + # Call test_commit with the arguments " [ [ []]]" # # This will commit a file with the given contents and the given commit -- cgit v1.2.3