Code

Merge branch 'maint'
[git.git] / t / test-lib.sh
index 70ea7e089e21b1619d85b6ccfe9e70b8f11421ff..fb8974112598fa46f0eefb8d84be9bcf9a1eee09 100644 (file)
@@ -112,8 +112,9 @@ if test -n "$color"; then
                        *) test -n "$quiet" && return;;
                esac
                shift
-               echo "* $*"
+               printf "* $*"
                tput sgr0
+               echo
                )
        }
 else
@@ -449,6 +450,11 @@ test_done () {
                # we will leave things as they are.
 
                say_color pass "passed all $msg"
+
+               test -d "$remove_trash" &&
+               cd "$(dirname "$remove_trash")" &&
+               rm -rf "$(basename "$remove_trash")"
+
                exit 0 ;;
 
        *)
@@ -485,7 +491,8 @@ fi
 . ../GIT-BUILD-OPTIONS
 
 # Test repository
-test="trash directory"
+test="trash directory.$(basename "$0" .sh)"
+test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
 rm -fr "$test" || {
        trap - exit
        echo >&5 "FATAL: Cannot prepare test area"