Skip to content

Commit aed604c

Browse files
avargitster
authored andcommitted
test-lib: Use $TEST_DIRECTORY or $GIT_BUILD_DIR instead of $(pwd) and ../
Change the redundant calls to $(pwd) to use $TEST_DIRECTORY instead. None of these were being executed after we cd'd somewhere else so they weren't actually needed. This also makes it easier to add support for overriding the test library location and run tests in a different directory than t/. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5688995 commit aed604c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/test-lib.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -793,14 +793,14 @@ else # normal case, use ../bin-wrappers only unless $with_dashes:
793793
PATH="$TEST_DIRECTORY/..:$PATH"
794794
fi
795795
fi
796-
GIT_BUILD_DIR=$(pwd)/..
797-
GIT_TEMPLATE_DIR=$(pwd)/../templates/blt
796+
GIT_BUILD_DIR="$TEST_DIRECTORY"/..
797+
GIT_TEMPLATE_DIR="$TEST_DIRECTORY"/../templates/blt
798798
unset GIT_CONFIG
799799
GIT_CONFIG_NOSYSTEM=1
800800
GIT_CONFIG_NOGLOBAL=1
801801
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_CONFIG_NOGLOBAL
802802

803-
. ../GIT-BUILD-OPTIONS
803+
. "$GIT_BUILD_DIR"/GIT-BUILD-OPTIONS
804804

805805
if test -z "$GIT_TEST_CMP"
806806
then
@@ -812,22 +812,22 @@ then
812812
fi
813813
fi
814814

815-
GITPERLLIB=$(pwd)/../perl/blib/lib:$(pwd)/../perl/blib/arch/auto/Git
815+
GITPERLLIB="$TEST_DIRECTORY"/../perl/blib/lib:"$TEST_DIRECTORY"/../perl/blib/arch/auto/Git
816816
export GITPERLLIB
817-
test -d ../templates/blt || {
817+
test -d "$TEST_DIRECTORY"/../templates/blt || {
818818
error "You haven't built things yet, have you?"
819819
}
820820

821821
if test -z "$GIT_TEST_INSTALLED" && test -z "$NO_PYTHON"
822822
then
823-
GITPYTHONLIB="$(pwd)/../git_remote_helpers/build/lib"
823+
GITPYTHONLIB="$TEST_DIRECTORY/../git_remote_helpers/build/lib"
824824
export GITPYTHONLIB
825-
test -d ../git_remote_helpers/build || {
825+
test -d "$TEST_DIRECTORY"/../git_remote_helpers/build || {
826826
error "You haven't built git_remote_helpers yet, have you?"
827827
}
828828
fi
829829

830-
if ! test -x ../test-chmtime; then
830+
if ! test -x "$TEST_DIRECTORY"/../test-chmtime; then
831831
echo >&2 'You need to build test-chmtime:'
832832
echo >&2 'Run "make test-chmtime" in the source (toplevel) directory'
833833
exit 1

0 commit comments

Comments
 (0)