diff options
Diffstat (limited to 'git-sh-setup.sh')
-rwxr-xr-x | git-sh-setup.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index dbdf209ec0..838233926f 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 } |