{"thread":{"id":"34157","subject":"[PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path","startedAt":"2013-06-15T23:01:11Z","lastAt":"2013-06-18T14:36:52Z","messageCount":5,"participants":["Dennis Kaarsemaker","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"220965","messageId":"20130615230108.GA21005@kaarsemaker.net","threadId":"34157","inReplyTo":null,"subject":"[PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2013-06-15T23:01:11Z","receivedAt":"2013-06-15T23:01:11Z","isPatch":true,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"make and make test both work when $GIT_DIR isn't .git, but make dist\nincluded a bogus GIT-VERSION-FILE.\n\nSigned-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>\n---\n I'm doing daily builds of git, using many workers and a shared git.git,\n with per-worker checkouts, it would be really useful if GIT-VERSION-GEN\n actually supports this and doesn't generate a fairly bogus\n GIT-VERSION-FILE.\n\n GIT-VERSION-GEN | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 390782f..7dcca28 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -11,7 +11,7 @@ LF='\n if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n-elif test -d .git -o -f .git &&\n+elif test -d .git -o -f .git -o test -d $GIT_DIR &&\n \tVN=$(git describe --match \"v[0-9]*\" --abbrev=7 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n-- \n1.8.2.4.g940421e\n"},{"id":"221096","messageId":"7v38sgcxjp.fsf@alter.siamese.dyndns.org","threadId":"34157","inReplyTo":"20130615230108.GA21005@kaarsemaker.net","subject":"Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-17T20:06:02Z","receivedAt":"2013-06-17T20:06:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n\n>  I'm doing daily builds of git, using many workers and a shared git.git,\n>  with per-worker checkouts\n\nOK, so GIT_DIR is explicitly specified in these \"workers\".\n\nMakes sense.\n"},{"id":"221097","messageId":"7vy5a8biu8.fsf@alter.siamese.dyndns.org","threadId":"34157","inReplyTo":"7v38sgcxjp.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-17T20:09:03Z","receivedAt":"2013-06-17T20:09:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n>\n>>  I'm doing daily builds of git, using many workers and a shared git.git,\n>>  with per-worker checkouts\n>\n> OK, so GIT_DIR is explicitly specified in these \"workers\".\n>\n> Makes sense.\n\nActually it does not.  What if GIT_DIR is an empty string or not set\nat all?  The patch breaks the build for everybody else, doesn't it?\n\nPerhaps like this instead?\n\n GIT-VERSION-GEN | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 2908204..91ec831 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -11,7 +11,7 @@ LF='\n if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n-elif test -d .git -o -f .git &&\n+elif test -d ${GIT_DIR:-.git} -o -f .git &&\n \tVN=$(git describe --match \"v[0-9]*\" --abbrev=7 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n"},{"id":"221154","messageId":"1371540006.32543.5.camel@localhost","threadId":"34157","inReplyTo":"7vy5a8biu8.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path","fromName":"Dennis Kaarsemaker","fromEmail":"dennis@kaarsemaker.net","sentAt":"2013-06-18T07:20:06Z","receivedAt":"2013-06-18T07:20:06Z","isPatch":true,"sender":{"key":"dennis@kaarsemaker.net","avatar":"https://avatars.githubusercontent.com/u/200649?v=4"},"body":"On ma, 2013-06-17 at 13:09 -0700, Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n> >\n> >>  I'm doing daily builds of git, using many workers and a shared git.git,\n> >>  with per-worker checkouts\n> >\n> > OK, so GIT_DIR is explicitly specified in these \"workers\".\n\nYes, both GIT_DIR and GIT_WORK_TREE are set and the use of .git/HEAD and\nanything relying on it is shunned, so workers can run checkout as they\nplease.\n\n> > Makes sense.\n>\n> Actually it does not.  What if GIT_DIR is an empty string or not set\n> at all?  The patch breaks the build for everybody else, doesn't it?\n\nIt does indeed, I only tested in my setup and not with a normal make\ntest. Apologies.\n\n> Perhaps like this instead?\n>\n>  GIT-VERSION-GEN | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\n> index 2908204..91ec831 100755\n> --- a/GIT-VERSION-GEN\n> +++ b/GIT-VERSION-GEN\n> @@ -11,7 +11,7 @@ LF='\n>  if test -f version\n>  then\n>  \tVN=$(cat version) || VN=\"$DEF_VER\"\n> -elif test -d .git -o -f .git &&\n> +elif test -d ${GIT_DIR:-.git} -o -f .git &&\n>  \tVN=$(git describe --match \"v[0-9]*\" --abbrev=7 HEAD 2>/dev/null) &&\n>  \tcase \"$VN\" in\n>  \t*$LF*) (exit 1) ;;\n\nYes, that makes a lot more sense and actually works in normal make test\nand with a detached .git. Do you want me to send an updated patch?\n\n-- \nDennis Kaarsemaker\nwww.kaarsemaker.net\n"},{"id":"221230","messageId":"7vwqpr8ozf.fsf@alter.siamese.dyndns.org","threadId":"34157","inReplyTo":"1371540006.32543.5.camel@localhost","subject":"Re: [PATCH] GIT-VERSION-GEN: support non-standard $GIT_DIR path","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-18T14:36:52Z","receivedAt":"2013-06-18T14:36:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n\n> On ma, 2013-06-17 at 13:09 -0700, Junio C Hamano wrote:\n>> Junio C Hamano <gitster@pobox.com> writes:\n>> \n>> > Dennis Kaarsemaker <dennis@kaarsemaker.net> writes:\n>> >\n>> >>  I'm doing daily builds of git, using many workers and a shared git.git,\n>> >>  with per-worker checkouts\n>> >\n>> > OK, so GIT_DIR is explicitly specified in these \"workers\".\n>\n> Yes, both GIT_DIR and GIT_WORK_TREE are set and the use of .git/HEAD and\n> anything relying on it is shunned, so workers can run checkout as they\n> please.\n>\n>> > Makes sense.\n>>\n>> Actually it does not.  What if GIT_DIR is an empty string or not set\n>> at all?  The patch breaks the build for everybody else, doesn't it?\n>\n> It does indeed, I only tested in my setup and not with a normal make\n> test. Apologies.\n>\n>> Perhaps like this instead?\n>>\n>>  GIT-VERSION-GEN | 2 +-\n>>  1 file changed, 1 insertion(+), 1 deletion(-)\n>> \n>> diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\n>> index 2908204..91ec831 100755\n>> --- a/GIT-VERSION-GEN\n>> +++ b/GIT-VERSION-GEN\n>> @@ -11,7 +11,7 @@ LF='\n>>  if test -f version\n>>  then\n>>  \tVN=$(cat version) || VN=\"$DEF_VER\"\n>> -elif test -d .git -o -f .git &&\n>> +elif test -d ${GIT_DIR:-.git} -o -f .git &&\n>>  \tVN=$(git describe --match \"v[0-9]*\" --abbrev=7 HEAD 2>/dev/null) &&\n>>  \tcase \"$VN\" in\n>>  \t*$LF*) (exit 1) ;;\n>\n> Yes, that makes a lot more sense and actually works in normal make test\n> and with a detached .git. Do you want me to send an updated patch?\n\nI think I've locally amended it already before queueing it to 'pu',\nso no need to resend.\n\nThanks.\n"}]}