summaryrefslogtreecommitdiff
path: root/git-sh-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-xgit-sh-setup.sh8
1 files changed, 7 insertions, 1 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index dbdf209..8382339 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -85,7 +85,13 @@ cd_to_toplevel () {
cdup=$(git rev-parse --show-cdup)
if test ! -z "$cdup"
then
- cd "$cdup" || {
+ # The "-P" option says to follow "physical" directory
+ # structure instead of following symbolic links. When cdup is
+ # "../", this means following the ".." entry in the current
+ # directory instead textually removing a symlink path element
+ # from the PWD shell variable. The "-P" behavior is more
+ # consistent with the C-style chdir used by most of Git.
+ cd -P "$cdup" || {
echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree"
exit 1
}