Use "cd -P" instead of just "cd" when switching to the top level of the git working directory. When working from a symlink into GIT_WORK_TREE, the shell function cd_to_toplevel will now change to GIT_WORK_TREE rather than the parent of the symlink, which may not even be the root of a git working directory. Unfortunately this solution looks non-portable. Signed-off-by: Marcel M. Cary <marcel@xxxxxxxxxxxxxxxx> --- git-sh-setup.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index dbdf209..4006150 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -85,7 +85,7 @@ cd_to_toplevel () { cdup=$(git rev-parse --show-cdup) if test ! -z "$cdup" then - cd "$cdup" || { + cd -P "$cdup" || { echo >&2 "Cannot chdir to $cdup, the toplevel of the working tree" exit 1 } -- 1.6.0.3 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html