Skip to content

Commit

Permalink
tests: provide $TRASH_DIRECTORY variable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeff King authored and Junio C Hamano committed Aug 9, 2009
1 parent eaf0551 commit 91c8b82
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,12 @@ test_expect_success 'format-patch from a subdirectory (2)' '
'

test_expect_success 'format-patch from a subdirectory (3)' '
here="$TEST_DIRECTORY/$test" &&
rm -f 0* &&
filename=$(
rm -rf sub &&
mkdir -p sub/dir &&
cd sub/dir &&
git format-patch -1 -o "$here"
git format-patch -1 -o "$TRASH_DIRECTORY"
) &&
basename=$(expr "$filename" : ".*/\(.*\)") &&
test -f "$basename"
Expand Down
3 changes: 2 additions & 1 deletion t/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,8 @@ fi

# Test repository
test="trash directory.$(basename "$0" .sh)"
test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
TRASH_DIRECTORY="$TEST_DIRECTORY/$test"
test ! -z "$debug" || remove_trash=$TRASH_DIRECTORY
rm -fr "$test" || {
GIT_EXIT_OK=t
echo >&5 "FATAL: Cannot prepare test area"
Expand Down

0 comments on commit 91c8b82

Please sign in to comment.