t/test-lib.sh: fix TRASH_DIRECTORY handling
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>
John Keeping committed
Apr 14, 2013 at 17:34 UTC
38b074de80759c95fec20b0dbc30614caccdfd24
1 file changed
+4
-4
t/test-lib.sh
+4
-4
@@ -599,7 +599,7 @@ case "$test" in
599
*) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$test" ;;
600
esac
601
test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
602
-rm -fr "$test" || {
602
+rm -fr "$TRASH_DIRECTORY" || {
603
GIT_EXIT_OK=t
604
echo >&5 "FATAL: Cannot prepare test area"
605
exit 1
@@ -610,13 +610,13 @@ export HOME
610
611
if test -z "$TEST_NO_CREATE_REPO"
612
then
613
- test_create_repo "$test"
613
+ test_create_repo "$TRASH_DIRECTORY"
614
else
615
- mkdir -p "$test"
615
+ mkdir -p "$TRASH_DIRECTORY"
616
fi
617
# Use -P to resolve symlinks in our working directory so that the cwd
618
# in subprocesses like git equals our $PWD (for pathname comparisons).
619
-cd -P "$test" || exit 1
619
+cd -P "$TRASH_DIRECTORY" || exit 1
620
621
this_test=${0##*/}
622
this_test=${this_test%%-*}