{"thread":{"id":"23778","subject":"[RFC PATCH] GIT-VERSION-GEN: restrict tags used","startedAt":"2010-05-11T17:33:18Z","lastAt":"2010-05-12T05:54:02Z","messageCount":6,"participants":["Tay Ray Chuan","Jonathan Nieder","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"141487","messageId":"1273599198-1008-1-git-send-email-rctay89@gmail.com","threadId":"23778","inReplyTo":null,"subject":"[RFC PATCH] GIT-VERSION-GEN: restrict tags used","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-05-11T17:33:18Z","receivedAt":"2010-05-11T17:33:18Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Restrict the tags used to generate the version string to those that\nbegin with \"v\", since git's tags for git-core (ie. excluding git-gui)\nare all of the form \"vX.Y...\".\n\nThis is to avoid using private tags by the user in a clone of the git\ncode repository, which may break certain machinery (eg. Makefile).\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n\n  Ran into this after tagging a topic branch and running make.\n\n  Although a \"v.*\" match does not guarantee the non-usage of private\n  tags, I feel it's an acceptable level of accuracy.\n\n  After this patch, perhaps we could advertise somewhere to git hackers\n  that tags beginning with \"v\" should be avoided.\n\n GIT-VERSION-GEN |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 59219bd..28b4d56 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -12,7 +12,7 @@ if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n elif test -d .git -o -f .git &&\n-\tVN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&\n+\tVN=$(git describe --match \"v*\" --abbrev=4 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n \tv[0-9]*)\n--\n1.7.1.189.g07419\n"},{"id":"141494","messageId":"20100511230100.GB31163@progeny.tock","threadId":"23778","inReplyTo":"1273599198-1008-1-git-send-email-rctay89@gmail.com","subject":"Re: [RFC PATCH] GIT-VERSION-GEN: restrict tags used","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-11T23:01:00Z","receivedAt":"2010-05-11T23:01:00Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Tay Ray Chuan wrote:\n\n> Restrict the tags used to generate the version string to those that\n> begin with \"v\"\n\nI like it.  Thanks!\n\n> since git's tags for git-core (ie. excluding git-gui)\n> are all of the form \"vX.Y...\".\n\ngit gui’s too, now.\n\n> This is to avoid using private tags by the user in a clone of the git\n> code repository, which may break certain machinery (eg. Makefile).\n\nNot to mention gitk:\n\n  set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]\n  if {[package vcompare $git_version \"1.6.1\"] >= 0} {\n\nThis requires ‘git version’ output to have the form\n\n  introducing 1.2.3.otherstuff\n\nor there will be errors at startup time.\n\n>   After this patch, perhaps we could advertise somewhere to git hackers\n>   that tags beginning with \"v\" should be avoided.\n\nMaybe v[0-9]* would make this problem harder to trip.\n\nJonathan\n"},{"id":"141495","messageId":"20100511230542.GC31163@progeny.tock","threadId":"23778","inReplyTo":"20100511230100.GB31163@progeny.tock","subject":"Re: [RFC PATCH] GIT-VERSION-GEN: restrict tags used","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-11T23:05:42Z","receivedAt":"2010-05-11T23:05:42Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n> Tay Ray Chuan wrote:\n\n>> since git's tags for git-core (ie. excluding git-gui)\n>> are all of the form \"vX.Y...\".\n>\n> git gui’s too, now.\n\nAggh --- sent early, there.  Here is what I meant to say.\n\nShawn, this helps avoid any stray (annotated) tags the user may have\nmade, following Tay’s example.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex b3f937e..d6a6601 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -13,7 +13,7 @@ tree_search ()\n \tfor p in $(git rev-list --parents --max-count=1 $head 2>/dev/null)\n \tdo\n \t\ttest $tree = $(git rev-parse $p^{tree} 2>/dev/null) &&\n-\t\tvn=$(git describe --abbrev=4 $p 2>/dev/null) &&\n+\t\tvn=$(git describe --match=gitgui-[0-9]* --abbrev=4 $p 2>/dev/null) &&\n \t\tcase \"$vn\" in\n \t\tgitgui-[0-9]*) echo $vn; break;;\n \t\tesac\n-- \n"},{"id":"141501","messageId":"AANLkTim8SRUEaNWyBF_iRQstu84r9eAaUd0a9KLj6OtR@mail.gmail.com","threadId":"23778","inReplyTo":"20100511230100.GB31163@progeny.tock","subject":"Re: [RFC PATCH] GIT-VERSION-GEN: restrict tags used","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-05-12T03:23:02Z","receivedAt":"2010-05-12T03:23:02Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"On Wed, May 12, 2010 at 7:01 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Tay Ray Chuan wrote:\n>> This is to avoid using private tags by the user in a clone of the git\n>> code repository, which may break certain machinery (eg. Makefile).\n>\n> Not to mention gitk:\n>\n>  set git_version [join [lrange [split [lindex [exec git version] end] .] 0 2] .]\n>  if {[package vcompare $git_version \"1.6.1\"] >= 0} {\n>\n> This requires ‘git version’ output to have the form\n>\n>  introducing 1.2.3.otherstuff\n>\n> or there will be errors at startup time.\n\nThanks for the heads-up, I'll put that in the patch message.\n\n>>   After this patch, perhaps we could advertise somewhere to git hackers\n>>   that tags beginning with \"v\" should be avoided.\n>\n> Maybe v[0-9]* would make this problem harder to trip.\n\nOh, I didn't know character classes were allows. Sounds good.\n\n-- \nCheers,\nRay Chuan\n"},{"id":"141502","messageId":"1273634960-2728-1-git-send-email-rctay89@gmail.com","threadId":"23778","inReplyTo":"AANLkTim8SRUEaNWyBF_iRQstu84r9eAaUd0a9KLj6OtR@mail.gmail.com","subject":"[PATCH] GIT-VERSION-GEN: restrict tags used","fromName":"Tay Ray Chuan","fromEmail":"rctay89@gmail.com","sentAt":"2010-05-12T03:29:20Z","receivedAt":"2010-05-12T03:29:20Z","isPatch":true,"sender":{"key":"rctay89@gmail.com","avatar":"https://avatars.githubusercontent.com/u/61553?v=4"},"body":"Restrict the tags used to generate the version string to those that\nbegin with \"v\", since git's tags for git-core (ie. excluding git-gui)\nare all of the form \"vX.Y...\".\n\nThis is to avoid using private tags by the user in a clone of the git\ncode repository, which may break certain machinery (eg. Makefile, gitk).\n\nSigned-off-by: Tay Ray Chuan <rctay89@gmail.com>\n---\n\n  Changes from RFC:\n\n    - used \"v[0-9]*\" instead of just \"v*\"\n    - mentioned gitk as another piece that may break\n\n GIT-VERSION-GEN |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN\nindex 59219bd..e45513d 100755\n--- a/GIT-VERSION-GEN\n+++ b/GIT-VERSION-GEN\n@@ -12,7 +12,7 @@ if test -f version\n then\n \tVN=$(cat version) || VN=\"$DEF_VER\"\n elif test -d .git -o -f .git &&\n-\tVN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&\n+\tVN=$(git describe --match \"v[0-9]*\" --abbrev=4 HEAD 2>/dev/null) &&\n \tcase \"$VN\" in\n \t*$LF*) (exit 1) ;;\n \tv[0-9]*)\n--\n1.7.1.189.g07419\n"},{"id":"141505","messageId":"7vaas58y2t.fsf@alter.siamese.dyndns.org","threadId":"23778","inReplyTo":"1273634960-2728-1-git-send-email-rctay89@gmail.com","subject":"Re: [PATCH] GIT-VERSION-GEN: restrict tags used","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-05-12T05:54:02Z","receivedAt":"2010-05-12T05:54:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks.\n"}]}