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 <johannes.schindelin@gmx.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johannes Schindelin
2015-10-30 12:02:56 -07:00
committed by Junio C Hamano
parent 80980a1d5c
commit 6a94088cc3
3 changed files with 20 additions and 1 deletions

View File

@ -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 "<message> [<file> [<contents> [<tag>]]]"
#
# This will commit a file with the given contents and the given commit