[PATCH] Friendlier error message for commands that can't be run from a subdirectory.
- From
koreth@midwinter.com <koreth@midwinter.com>
- Date
- Jan 12, 2007, 18:35 UTC
- Message-ID
- <20070112183548.GA3940@midwinter.com>
- In-Reply-To
- <200701121501.24642.andyparkins@gmail.com>
Signed-off-by: Steven Grimm <koreth@midwinter.com> ---
This doesn't fix the underlying problem (those commands ought to work from any directory) but it is at least less baffling for the common case. It's pretty braindead -- if you for some reason have a .git directory inside one of your subdirectories, you'll get the old error message.
git-sh-setup.sh | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/git-sh-setup.sh b/git-sh-setup.sh index 4a02b38..803a3bc 100755 --- a/git-sh-setup.sh +++ b/git-sh-setup.sh @@ -60,6 +60,9 @@ esac if [ -z "$SUBDIRECTORY_OK" ] then : ${GIT_DIR=.git} + if [ ! -d "$GIT_DIR" ]; then + die "This command must be run from the root directory of a git repository." + fi GIT_DIR=$(GIT_DIR="$GIT_DIR" git-rev-parse --git-dir) || exit else GIT_DIR=$(git-rev-parse --git-dir) || exit
-- 1.5.0.rc0.g4083