Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path

Subsystems: the rest

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:47

Junio C Hamano [off-list ref] writes:
Dennis Kaarsemaker [off-list ref] writes:
quoted
 I'm doing daily builds of git, using many workers and a shared git.git,
 with per-worker checkouts
OK, so GIT_DIR is explicitly specified in these "workers".

Makes sense.
Actually it does not.  What if GIT_DIR is an empty string or not set
at all?  The patch breaks the build for everybody else, doesn't it?

Perhaps like this instead?

 GIT-VERSION-GEN | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 2908204..91ec831 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -11,7 +11,7 @@ LF='
 if test -f version
 then
 	VN=$(cat version) || VN="$DEF_VER"
-elif test -d .git -o -f .git &&
+elif test -d ${GIT_DIR:-.git} -o -f .git &&
 	VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;

Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path

From: Dennis Kaarsemaker <hidden>
Date: 2016-06-15 22:57:47

On ma, 2013-06-17 at 13:09 -0700, Junio C Hamano wrote:
Junio C Hamano [off-list ref] writes:
quoted
Dennis Kaarsemaker [off-list ref] writes:
quoted
 I'm doing daily builds of git, using many workers and a shared git.git,
 with per-worker checkouts
OK, so GIT_DIR is explicitly specified in these "workers".
Yes, both GIT_DIR and GIT_WORK_TREE are set and the use of .git/HEAD and
anything relying on it is shunned, so workers can run checkout as they
please.
quoted
Makes sense.
Actually it does not.  What if GIT_DIR is an empty string or not set
at all?  The patch breaks the build for everybody else, doesn't it?
It does indeed, I only tested in my setup and not with a normal make
test. Apologies.
quoted hunk
Perhaps like this instead?

 GIT-VERSION-GEN | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 2908204..91ec831 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -11,7 +11,7 @@ LF='
 if test -f version
 then
 	VN=$(cat version) || VN="$DEF_VER"
-elif test -d .git -o -f .git &&
+elif test -d ${GIT_DIR:-.git} -o -f .git &&
 	VN=$(git describe --match "v[0-9]*" --abbrev=7 HEAD 2>/dev/null) &&
 	case "$VN" in
 	*$LF*) (exit 1) ;;
Yes, that makes a lot more sense and actually works in normal make test
and with a detached .git. Do you want me to send an updated patch?

-- 
Dennis Kaarsemaker
www.kaarsemaker.net
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help