Explain "Not a git repository: '.git'".
[gitweb.git] / git-sh-setup.sh
index 4a02b3825ecc15cb289a1dadb328e39a1869f3f1..57f7f7777602eadc79b6bb04e6652d81d14d770c 100755 (executable)
@@ -60,7 +60,11 @@ esac
 if [ -z "$SUBDIRECTORY_OK" ]
 then
        : ${GIT_DIR=.git}
-       GIT_DIR=$(GIT_DIR="$GIT_DIR" git-rev-parse --git-dir) || exit
+       GIT_DIR=$(GIT_DIR="$GIT_DIR" git-rev-parse --git-dir) || {
+               exit=$?
+               echo >&2 "You need to run this command from the toplevel of the working tree."
+               exit $exit
+       }
 else
        GIT_DIR=$(git-rev-parse --git-dir) || exit
 fi