DORMANTno replies

[PATCH] Export GIT_DIR after setting it

From: martin f. krafft <hidden>
Date: 2016-06-15 22:44:36
Subsystem: the rest · Maintainer: Linus Torvalds

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