Code

Fix misspelled mergetool.keepBackup
[git.git] / git-sh-setup.sh
index dbdf209ec0e7d6468c199d1905c3e7788a9cd246..838233926f7ed07f781f2eb2e7547a2a5a086071 100755 (executable)
@@ -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
                }