[PATCH] Friendlier error message for commands that can't be run from a subdirectory.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Steven Grimm <koreth@xxxxxxxxxxxxx>
---

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

-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]