path: root/t
diff options
authorJunio C Hamano <>2015-11-03 23:13:05 (GMT)
committerJunio C Hamano <>2015-11-03 23:13:05 (GMT)
commit4b571eb0c2149a3a45d7fe8bf2e93e67eab4a4c9 (patch)
tree71ba036af639a33c0c3da5cfc975ae4bd1a10034 /t
parentacfeaf8c962772e482bb705afd93bea7a7fa078e (diff)
parent6a94088cc3d539bdc15b824befc083f7ff8d0288 (diff)
Merge branch 'js/git-gdb'
Allow easier debugging of a single "git" invocation in our test scripts. * js/git-gdb: test: facilitate debugging Git executables in tests with gdb
Diffstat (limited to 't')
2 files changed, 13 insertions, 0 deletions
diff --git a/t/README b/t/README
index 35438bc..1dc908e 100644
--- a/t/README
+++ b/t/README
@@ -563,6 +563,11 @@ library for your script to use.
argument. This is primarily meant for use during the
development of a new test script.
+ - debug <git-command>
+ Run a git command inside a debugger. This is primarily meant for
+ use when debugging a failing test script.
- test_done
Your test script must have test_done at the end. Its purpose
diff --git a/t/ b/t/
index 6dffb8b..73e37a1 100644
--- a/t/
+++ b/t/
@@ -145,6 +145,14 @@ test_pause () {
+# 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