t/test-lib.sh: fix TRASH_DIRECTORY handling
authorJohn Keeping <john@keeping.me.uk>
Sun, 14 Apr 2013 16:34:56 +0000 (17:34 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Apr 2013 06:30:21 +0000 (23:30 -0700)
After the location of $TRASH_DIRECTORY is adjusted by
$TEST_OUTPUT_DIRECTORY, we go on to use the $test variable to make the
trash directory and cd into it. This means that when
$TEST_OUTPUT_DIRECTORY is not "." and an absolute --root has not been
specified, we do not remove the trash directory once the tests are
complete (remove_trash is set to $TRASH_DIRECTORY).

Fix this by always referring to the trash directory as $TRASH_DIRECTORY.

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: Jeff King <peff@peff.net>
Acked-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh
index 8d76cf23d46c813991fbf59da2f1f3b79110547c..c5121f49839def242ef78e556519f03b712b8110 100644 (file)
@@ -599,7 +599,7 @@ case "$test" in
  *) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$test" ;;
 esac
 test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
-rm -fr "$test" || {
+rm -fr "$TRASH_DIRECTORY" || {
        GIT_EXIT_OK=t
        echo >&5 "FATAL: Cannot prepare test area"
        exit 1
@@ -610,13 +610,13 @@ export HOME
 
 if test -z "$TEST_NO_CREATE_REPO"
 then
-       test_create_repo "$test"
+       test_create_repo "$TRASH_DIRECTORY"
 else
-       mkdir -p "$test"
+       mkdir -p "$TRASH_DIRECTORY"
 fi
 # Use -P to resolve symlinks in our working directory so that the cwd
 # in subprocesses like git equals our $PWD (for pathname comparisons).
-cd -P "$test" || exit 1
+cd -P "$TRASH_DIRECTORY" || exit 1
 
 this_test=${0##*/}
 this_test=${this_test%%-*}