aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2013-11-17 23:12:43 -0500
committerJunio C Hamano <gitster@pobox.com>2013-11-18 13:45:56 -0800
commit85176d725134446ca2b8585d85f8fbd2daf45515 (patch)
tree66c22ed790b1707ccb717c3abde0520dfa42b06b
parentc939d241673ad093336e936075a029127368d87e (diff)
downloadgit-85176d725134446ca2b8585d85f8fbd2daf45515.tar.gz
git-85176d725134446ca2b8585d85f8fbd2daf45515.tar.xz
test-lib.sh: convert $TEST_DIRECTORY to an absolute path
If $TEST_DIRECTORY is specified in the environment, convert the value to an absolute path to ensure that it remains valid even when 'cd' is used. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Reviewed-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Richard Hansen <rhansen@bbn.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--t/test-lib.sh4
1 files changed, 4 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index b25249ec4..d303e6c94 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -26,6 +26,10 @@ then
# outside of t/, e.g. for running tests on the test library
# itself.
TEST_DIRECTORY=$(pwd)
+else
+ # ensure that TEST_DIRECTORY is an absolute path so that it
+ # is valid even if the current working directory is changed
+ TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
fi
if test -z "$TEST_OUTPUT_DIRECTORY"
then