summaryrefslogtreecommitdiff
path: root/t/t2300-cd-to-toplevel.sh
diff options
context:
space:
mode:
authorMarcel M. Cary <marcel@oak.homeunix.org>2009-02-07 03:24:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-02-07 08:45:29 (GMT)
commit2c3c395e84409c278bd7b050877c36d04b952056 (patch)
tree65662f26b92ed2d8c973964b6985d29b6db44149 /t/t2300-cd-to-toplevel.sh
parentba743d1b0ce0b44c797c0de06c9db2781e4d1fdd (diff)
downloadgit-2c3c395e84409c278bd7b050877c36d04b952056.zip
git-2c3c395e84409c278bd7b050877c36d04b952056.tar.gz
git-2c3c395e84409c278bd7b050877c36d04b952056.tar.bz2
git-sh-setup: Use "cd" option, not /bin/pwd, for symlinked work tree
In cd_to_toplevel, instead of 'cd $(unset PWD; /bin/pwd)/$path' use 'cd -P $path'. The "-P" option yields a desirable similarity to C chdir. While the "-P" option may be slightly less commonly supported than /bin/pwd, it is more concise, better tested, and less error prone. I've already added the 'unset PWD' to fix the /bin/pwd solution on BSD; there may be more edge cases out there. This still passes all the same test cases in t5521-pull-symlink.sh and t2300-cd-to-toplevel.sh, even before updating them to use 'pwd -P'. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2300-cd-to-toplevel.sh')
-rwxr-xr-xt/t2300-cd-to-toplevel.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t2300-cd-to-toplevel.sh b/t/t2300-cd-to-toplevel.sh
index e42cbfe..293dc35 100755
--- a/t/t2300-cd-to-toplevel.sh
+++ b/t/t2300-cd-to-toplevel.sh
@@ -10,12 +10,12 @@ test_cd_to_toplevel () {
cd '"'$1'"' &&
. git-sh-setup &&
cd_to_toplevel &&
- [ "$(unset PWD; /bin/pwd)" = "$TOPLEVEL" ]
+ [ "$(pwd -P)" = "$TOPLEVEL" ]
)
'
}
-TOPLEVEL="$(unset PWD; /bin/pwd)/repo"
+TOPLEVEL="$(pwd -P)/repo"
mkdir -p repo/sub/dir
mv .git repo/
SUBDIRECTORY_OK=1