Signed-off-by: Steven Grimm <koreth@xxxxxxxxxxxxx> --- Or try this instead. It seems to work in my limited testing, but it's possible this breaks something somewhere. The only weird thing here is that if, e.g., you have a file foo.c in the top-level directory and you run "git pull" from a subdirectory, you'll see a message indicating that "foo.c" was updated, implying that it's updating that file in the current directory. (Output about files in subdirectories, to my eye, feels less ambiguous in that respect.) But after running with this for just a few minutes, I'm willing to put up with that in exchange for not having to manually cd. git-sh-setup.sh | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 4a02b38..d1c78c4 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -59,8 +59,13 @@ esac # Make sure we are in a valid repository of a vintage we understand. if [ -z "$SUBDIRECTORY_OK" ] then - : ${GIT_DIR=.git} - GIT_DIR=$(GIT_DIR="$GIT_DIR" git-rev-parse --git-dir) || exit + GIT_DIR=$(git-rev-parse --git-dir) || exit + if [ "$GIT_DIR" != ".git" -a "$(basename \"$GIT_DIR\")" = ".git" ] + then + # In a subdirectory of a non-bare repository; move to root dir + cd "`dirname \"$GIT_DIR\"`" || \ + die "Can't change to repository root directory" + fi else GIT_DIR=$(git-rev-parse --git-dir) || exit fi -- 1.5.0.rc0.g4083 - 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