Junio C Hamano <gitster@xxxxxxxxx> writes: > I wonder if this would be a safer alternative, or is it doing too > much more than what is necessary? An alternative with much smaller blast radius would be to do this. Hopefully, by going "$(pwd)/." before asking the value returned by the `pwd` command, we can make sure that the trailing slash is removed (or at least $(pwd) and $TEST_DIRECTORY should be identical after this is done). t/test-lib.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git c/t/test-lib.sh w/t/test-lib.sh index 1656c9eed0..d159358b21 100644 --- c/t/test-lib.sh +++ w/t/test-lib.sh @@ -19,9 +19,13 @@ # t/ subdirectory and are run in 'trash directory' subdirectory. if test -z "$TEST_DIRECTORY" then - # ensure that TEST_DIRECTORY is an absolute path so that it + # Ensure that TEST_DIRECTORY is an absolute path so that it # is valid even if the current working directory is changed - TEST_DIRECTORY=$(pwd) + # Some environments can talk the shell into keeping trailing + # slash in $PWD---go there and ask where we are to work it + # around, as we expect TEST_DIRECTORY and PWD are both + # canonical and can textually be compared for equality + TEST_DIRECTORY=$(cd "$(pwd)/." && pwd) else # The TEST_DIRECTORY will always be the path to the "t" # directory in the git.git checkout. This is overridden by