From: Felipe Contreras Date: Mon, 18 Nov 2013 04:12:43 +0000 (-0500) Subject: test-lib.sh: convert $TEST_DIRECTORY to an absolute path X-Git-Tag: v1.9-rc0~87^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=85176d72513;p=thirdparty%2Fgit.git 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 Reviewed-by: Richard Hansen Signed-off-by: Richard Hansen Signed-off-by: Junio C Hamano --- diff --git a/t/test-lib.sh b/t/test-lib.sh index b25249ec4c..d303e6c943 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