Skip to content

Commit 38b074d

Browse files
johnkeepinggitster
authored andcommitted
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 <[email protected]> Acked-by: Jeff King <[email protected]> Acked-by: Thomas Rast <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a46221e commit 38b074d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

t/test-lib.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ case "$test" in
599599
*) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$test" ;;
600600
esac
601601
test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
602-
rm -fr "$test" || {
602+
rm -fr "$TRASH_DIRECTORY" || {
603603
GIT_EXIT_OK=t
604604
echo >&5 "FATAL: Cannot prepare test area"
605605
exit 1
@@ -610,13 +610,13 @@ export HOME
610610

611611
if test -z "$TEST_NO_CREATE_REPO"
612612
then
613-
test_create_repo "$test"
613+
test_create_repo "$TRASH_DIRECTORY"
614614
else
615-
mkdir -p "$test"
615+
mkdir -p "$TRASH_DIRECTORY"
616616
fi
617617
# Use -P to resolve symlinks in our working directory so that the cwd
618618
# in subprocesses like git equals our $PWD (for pathname comparisons).
619-
cd -P "$test" || exit 1
619+
cd -P "$TRASH_DIRECTORY" || exit 1
620620

621621
this_test=${0##*/}
622622
this_test=${this_test%%-*}

0 commit comments

Comments
 (0)