[PATCH] Export GIT_DIR after setting it

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

 



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@xxxxxxxxxxx>
---
 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

--
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]

  Powered by Linux