Skip to content

Commit 91c8b82

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent eaf0551 commit 91c8b82

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

t/t4014-format-patch.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,13 +493,12 @@ test_expect_success 'format-patch from a subdirectory (2)' '
493493
'
494494

495495
test_expect_success 'format-patch from a subdirectory (3)' '
496-
here="$TEST_DIRECTORY/$test" &&
497496
rm -f 0* &&
498497
filename=$(
499498
rm -rf sub &&
500499
mkdir -p sub/dir &&
501500
cd sub/dir &&
502-
git format-patch -1 -o "$here"
501+
git format-patch -1 -o "$TRASH_DIRECTORY"
503502
) &&
504503
basename=$(expr "$filename" : ".*/\(.*\)") &&
505504
test -f "$basename"

t/test-lib.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,8 @@ fi
645645

646646
# Test repository
647647
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
649650
rm -fr "$test" || {
650651
GIT_EXIT_OK=t
651652
echo >&5 "FATAL: Cannot prepare test area"

0 commit comments

Comments
 (0)