git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "martin f. krafft" <madduck@madduck.net>
To: git@vger.kernel.org
Cc: "martin f. krafft" <madduck@madduck.net>
Subject: [PATCH] Export GIT_DIR after setting it
Date: Thu, 15 May 2008 00:23:21 +0100	[thread overview]
Message-ID: <1210807401-11201-1-git-send-email-madduck@madduck.net> (raw)

git-sh-setup might set GIT_DIR, but not export it. When git-pull, for
instance, calls cd_to_toplevel, it changes the working directory, and later
calls git-ls-files, which does *not* inherit GIT_DIR since it's not imported.
It thus does the detection again, but in a different environment, since the
working directory changed. This breaks stuff subtly, especially when
core.worktree is set.

The patch simply exports GIT_DIR and makes it work such that git-ls-files
doesn't redo the work (wrongly).

Thanks to Björn Steinbrink for his help.

Signed-off-by: martin f. krafft <madduck@madduck.net>
---
 git-sh-setup.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index a44b1c7..de90f07 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -128,6 +128,7 @@ get_author_ident_from_commit () {
 if test -z "$NONGIT_OK"
 then
 	GIT_DIR=$(git rev-parse --git-dir) || exit
+	export GIT_DIR
 	if [ -z "$SUBDIRECTORY_OK" ]
 	then
 		test -z "$(git rev-parse --show-cdup)" || {
-- 
1.5.5.1

             reply	other threads:[~2008-05-14 23:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14 23:23 martin f. krafft [this message]
2008-05-15  2:25 ` [PATCH] Export GIT_DIR after setting it Junio C Hamano
2008-05-15 10:15   ` martin f. krafft
2008-05-15 17:23     ` Junio C Hamano
2008-05-15 17:55       ` Björn Steinbrink
2008-05-15 18:28         ` martin f. krafft
2008-05-15 18:44           ` Björn Steinbrink
2008-05-16 21:50       ` martin f. krafft
2008-05-20 16:17   ` martin f. krafft

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=1210807401-11201-1-git-send-email-madduck@madduck.net \
    --to=madduck@madduck.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).