summaryrefslogtreecommitdiff
path: root/wrap-for-bin.sh
diff options
context:
space:
mode:
authorElijah Newren <newren@gmail.com>2018-04-24 16:46:45 -0700
committerJunio C Hamano <gitster@pobox.com>2018-04-25 10:47:22 +0900
commit842436466aa5d9f1e5f1a09d41d22d902006219c (patch)
tree56dad3da9119021dc8f6b0df47abceba92782907 /wrap-for-bin.sh
parentfe0a9eaf31dd0c349ae4308498c33a5c3794b293 (diff)
downloadgit-842436466aa5d9f1e5f1a09d41d22d902006219c.tar.gz
Make running git under other debugger-like programs easy
This allows us to run git, when using the script from bin-wrappers, under other programs. A few examples for usage within testsuite scripts: debug git checkout master debug --debugger=nemiver git $ARGS debug -d "valgrind --tool-memcheck --track-origins=yes" git $ARGS Or, if someone has bin-wrappers/ in their $PATH and is executing git outside the testsuite: GIT_DEBUGGER="gdb --args" git $ARGS GIT_DEBUGGER=nemiver git $ARGS GIT_DEBUGGER="valgrind --tool=memcheck --track-origins=yes" git $ARGS There is also a handy shortcut of GIT_DEBUGGER=1 meaning the same as GIT_DEBUGGER="gdb --args" Original-patch-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrap-for-bin.sh')
-rw-r--r--wrap-for-bin.sh19
1 files changed, 13 insertions, 6 deletions
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index 5842408817..95851b85b6 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -20,10 +20,17 @@ PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
-if test -n "$GIT_TEST_GDB"
-then
- unset GIT_TEST_GDB
- exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
-else
+case "$GIT_DEBUGGER" in
+'')
exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
-fi
+ ;;
+1)
+ unset GIT_DEBUGGER
+ exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ ;;
+*)
+ GIT_DEBUGGER_ARGS="$GIT_DEBUGGER"
+ unset GIT_DEBUGGER
+ exec ${GIT_DEBUGGER_ARGS} "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+ ;;
+esac