tests: provide $TRASH_DIRECTORY variable
Most scripts don't care about the absolute path to the trash directory. The one exception was t4014 script, which pieced together $TEST_DIRECTORY and $test itself to get an absolute directory. Instead, let's provide a $TRASH_DIRECTORY which specifies the same thing. This keeps the $test variable internal to test-lib.sh and paves the way for trash directories in other locations. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Aug 9, 2009 at 04:38 UTC
91c8b825ce2a301e9861be60c3d7853fefa93c04
2 files changed
+3
-3
t/t4014-format-patch.sh
+1
-2
@@ -493,13 +493,12 @@ test_expect_success 'format-patch from a subdirectory (2)' '
493
'
494
495
test_expect_success 'format-patch from a subdirectory (3)' '
496
- here="$TEST_DIRECTORY/$test" &&
496
rm -f 0* &&
497
filename=$(
498
rm -rf sub &&
499
mkdir -p sub/dir &&
500
cd sub/dir &&
502
- git format-patch -1 -o "$here"
501
+ git format-patch -1 -o "$TRASH_DIRECTORY"
502
) &&
503
basename=$(expr "$filename" : ".*/\(.*\)") &&
504
test -f "$basename"
t/test-lib.sh
+2
-1
@@ -645,7 +645,8 @@ fi
645
646
# Test repository
647
test="trash directory.$(basename "$0" .sh)"
648
-test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
648
+TRASH_DIRECTORY="$TEST_DIRECTORY/$test"
649
+test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
650
rm -fr "$test" || {
651
GIT_EXIT_OK=t
652
echo >&5 "FATAL: Cannot prepare test area"