From: Robert Shearman <rob@codeweavers.com>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] git-sh-setup: Fail if the git directory was not found.
Date: Fri, 11 Aug 2006 10:23:30 +0100 [thread overview]
Message-ID: <44DC4C92.5060009@codeweavers.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 829 bytes --]
Always use git-rev-parse to find a valid git directory, as
git-repo-config no longer returns an error code if a git directory
wasn't found.
This fixes the message received when invoking certain commands
implemented as shell scripts from outside of a git tree, so e.g. instead
of receiving this:
/home/rob/bin/git-fetch: line 89: /FETCH_HEAD: Permission denied
We get this again:
fatal: Not a git repository: '.git'
Also, move the setting of GIT_OBJECT_DIRECTORY to outside of the
non-subdir-ok case as it isn't specific to that case.
Signed-off-by: Robert Shearman <rob@codeweavers.com>
---
git-sh-setup.sh | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
Hopefully this patch addresses the concerns of Junio and others by
continuing to allow git-ls-remotes to work outside of a git repository.
[-- Attachment #2: 268921fd0b2e7ff56c9b455a0129b0e8712fc191.diff --]
[-- Type: text/x-patch, Size: 588 bytes --]
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index d15747f..49f9e3b 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -37,15 +37,9 @@ esac
if [ -z "$SUBDIRECTORY_OK" ]
then
- : ${GIT_DIR=.git}
- : ${GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"}
-
- # Make sure we are in a valid repository of a vintage we understand.
- GIT_DIR="$GIT_DIR" git repo-config --get core.nosuch >/dev/null
- if test $? = 128
- then
- exit
- fi
+ GIT_DIR=$(GIT_DIR=.git git-rev-parse --git-dir) || exit
else
GIT_DIR=$(git-rev-parse --git-dir) || exit
fi
+
+GIT_OBJECT_DIRECTORY="$GIT_DIR/objects"
next reply other threads:[~2006-08-11 9:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-11 9:23 Robert Shearman [this message]
2006-08-11 19:42 ` [PATCH] git-sh-setup: Fail if the git directory was not found Alex Riesen
2006-08-11 22:39 ` Junio C Hamano
2006-08-12 1:47 ` Junio C Hamano
2006-08-13 11:52 ` Robert Shearman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44DC4C92.5060009@codeweavers.com \
--to=rob@codeweavers.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.