sha1-file.c: mark more strings for translation
[gitweb.git] / t / test-lib-functions.sh
index dfe99b080f676b85e01fc78da9a5769702be61d3..2b2181dca09089ed36d10ee8f6f67eedda8cf352 100644 (file)
@@ -145,12 +145,28 @@ test_pause () {
        "$SHELL_PATH" <&6 >&5 2>&7
 }
 
-# Wrap git in gdb. Adding this to a command can make it easier to
-# understand what is going on in a failing test.
+# Wrap git with a debugger. Adding this to a command can make it easier
+# to understand what is going on in a failing test.
 #
-# Example: "debug git checkout master".
+# Examples:
+#     debug git checkout master
+#     debug --debugger=nemiver git $ARGS
+#     debug -d "valgrind --tool=memcheck --track-origins=yes" git $ARGS
 debug () {
-        GIT_TEST_GDB=1 "$@" <&6 >&5 2>&7
+       case "$1" in
+       -d)
+               GIT_DEBUGGER="$2" &&
+               shift 2
+               ;;
+       --debugger=*)
+               GIT_DEBUGGER="${1#*=}" &&
+               shift 1
+               ;;
+       *)
+               GIT_DEBUGGER=1
+               ;;
+       esac &&
+       GIT_DEBUGGER="${GIT_DEBUGGER}" "$@" <&6 >&5 2>&7
 }
 
 # Call test_commit with the arguments
@@ -794,11 +810,8 @@ verbose () {
 # otherwise.
 
 test_must_be_empty () {
-       if ! test -f "$1"
-       then
-               echo "'$1' is missing"
-               return 1
-       elif test -s "$1"
+       test_path_is_file "$1" &&
+       if test -s "$1"
        then
                echo "'$1' is not empty, it contains:"
                cat "$1"