Thread (6 messages) flat view 6 messages, 4 authors, 2016-06-15
DORMANTno replies

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

From: <hidden>
Date: 2016-06-15 22:42:49
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Steven Grimm <redacted>
---

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help