git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Export GIT_DIR after setting it
@ 2008-05-14 23:23 martin f. krafft
  2008-05-15  2:25 ` Junio C Hamano
  0 siblings, 1 reply; 9+ messages in thread
From: martin f. krafft @ 2008-05-14 23:23 UTC (permalink / raw)
  To: git; +Cc: martin f. krafft

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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-05-20 16:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-14 23:23 [PATCH] Export GIT_DIR after setting it martin f. krafft
2008-05-15  2:25 ` 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

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).