Skip to content

Commit 61f292d

Browse files
szedergitster
authored andcommitted
test-lib: set $TRASH_DIRECTORY earlier
A later patch in this series will need to know the path to the trash directory early in 'test-lib.sh', but $TRASH_DIRECTORY is set much later. Set $TRASH_DIRECTORY earlier, where the other test-specific path variables are set. Signed-off-by: SZEDER Gábor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 62c379b commit 61f292d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

t/test-lib.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,12 @@ fi
163163
TEST_NAME="$(basename "$0" .sh)"
164164
TEST_RESULTS_DIR="$TEST_OUTPUT_DIRECTORY/test-results"
165165
TEST_RESULTS_BASE="$TEST_RESULTS_DIR/$TEST_NAME"
166+
TRASH_DIRECTORY="trash directory.$TEST_NAME"
167+
test -n "$root" && TRASH_DIRECTORY="$root/$TRASH_DIRECTORY"
168+
case "$TRASH_DIRECTORY" in
169+
/*) ;; # absolute path is good
170+
*) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;;
171+
esac
166172

167173
# if --tee was passed, write the output not only to the terminal, but
168174
# additionally to the file test-results/$BASENAME.out, too.
@@ -1051,12 +1057,6 @@ then
10511057
fi
10521058

10531059
# Test repository
1054-
TRASH_DIRECTORY="trash directory.$TEST_NAME"
1055-
test -n "$root" && TRASH_DIRECTORY="$root/$TRASH_DIRECTORY"
1056-
case "$TRASH_DIRECTORY" in
1057-
/*) ;; # absolute path is good
1058-
*) TRASH_DIRECTORY="$TEST_OUTPUT_DIRECTORY/$TRASH_DIRECTORY" ;;
1059-
esac
10601060
rm -fr "$TRASH_DIRECTORY" || {
10611061
GIT_EXIT_OK=t
10621062
echo >&5 "FATAL: Cannot prepare test area"

0 commit comments

Comments
 (0)