{"thread":{"id":"5132","subject":"[PATCH] git-project-version","startedAt":"2006-08-04T21:48:25Z","lastAt":"2006-09-24T11:37:43Z","messageCount":3,"participants":["Santi Béjar","Petr Baudis","Santi"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"24761","messageId":"87bqr0tbo6.fsf@gmail.com","threadId":"5132","inReplyTo":null,"subject":"[PATCH] git-project-version","fromName":"Santi Béjar","fromEmail":"sbejar@gmail.com","sentAt":"2006-08-04T21:48:25Z","receivedAt":"2006-08-04T21:48:25Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"Introduce an easy way for projects to get its git version. This is\nsomething that other projects using git would like to do, and we don't\nwant them all reinventing the wheel.\n\nSigned-off-by: Santi Béjar <sbejar@gmail.com>\n---\nHi *,\n\nI would prefer an output with an explicit git string as:\n\nv1.4.2-rc3-git46faaaf\n\nAlso I would prefer the dirty state with an ending M as in:\n\nv1.4.2-rc3-git46faaaf-M\n\nto use the same letter of the diff family.\n\n   Santi\n\n Makefile               |    3 ++-\n git-project-version.sh |    9 +++++++++\n 2 files changed, 11 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex d662bd6..7c4e360 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -169,7 +169,8 @@ SCRIPT_SH = \\\n \tgit-applymbox.sh git-applypatch.sh git-am.sh \\\n \tgit-merge.sh git-merge-stupid.sh git-merge-octopus.sh \\\n \tgit-merge-resolve.sh git-merge-ours.sh \\\n-\tgit-lost-found.sh git-quiltimport.sh\n+\tgit-lost-found.sh git-quiltimport.sh \\\n+\tgit-project-version.sh\n \n SCRIPT_PERL = \\\n \tgit-archimport.perl git-cvsimport.perl git-relink.perl \\\ndiff --git a/git-project-version.sh b/git-project-version.sh\nnew file mode 100755\nindex 0000000..88b21fa\n--- /dev/null\n+++ b/git-project-version.sh\n@@ -0,0 +1,9 @@\n+#!/bin/sh\n+# First try git-describe.\n+VN=$(git describe --abbrev=4 HEAD 2>/dev/null) ||\n+VN=$(git rev-parse --short HEAD | sed -e 's/^/g/')\n+\n+dirty=$(sh -c 'git diff-index --name-only HEAD' 2>/dev/null) || dirty=\n+[ \"$dirty\" ] && VN=\"$VN-dirty\"\n+\n+echo $VN\n-- \n1.4.2.rc3.g3f0a-dirty\n"},{"id":"27524","messageId":"20060923235153.GH20017@pasky.or.cz","threadId":"5132","inReplyTo":"87bqr0tbo6.fsf@gmail.com","subject":"Re: [PATCH] git-project-version","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-09-23T23:51:53Z","receivedAt":"2006-09-23T23:51:53Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Aug 04, 2006 at 11:48:25PM CEST, I got a letter\nwhere Santi Béjar <sbejar@gmail.com> said that...\n> Introduce an easy way for projects to get its git version. This is\n> something that other projects using git would like to do, and we don't\n> want them all reinventing the wheel.\n> \n> Signed-off-by: Santi Béjar <sbejar@gmail.com>\n\nPerhaps it would be more useful to have a flag for git-describe to\ndescribe not the (HEAD) commit but your working copy (thus HEAD + check\nfor the dirtyness).\n\n-- \n\t\t\t\tPetr \"Pasky the Hater of Too Many\n\t\t\t\t\tCommands\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\nlK[d2%Sa2/d0$^Ixp\"|dc`;s/\\W//g;$_=pack('H*',/((..)*)$/)\n"},{"id":"27543","messageId":"8aa486160609240437v44fc3f20ucf664f99af37f1c0@mail.gmail.com","threadId":"5132","inReplyTo":"20060923235153.GH20017@pasky.or.cz","subject":"Re: [PATCH] git-project-version","fromName":"Santi","fromEmail":"sbejar@gmail.com","sentAt":"2006-09-24T11:37:43Z","receivedAt":"2006-09-24T11:37:43Z","isPatch":true,"sender":{"key":"santi@agolina.net","avatar":null},"body":"2006/9/24, Petr Baudis <pasky@suse.cz>:\n> Dear diary, on Fri, Aug 04, 2006 at 11:48:25PM CEST, I got a letter\n> where Santi Béjar <sbejar@gmail.com> said that...\n> > Introduce an easy way for projects to get its git version. This is\n> > something that other projects using git would like to do, and we don't\n> > want them all reinventing the wheel.\n> >\n> > Signed-off-by: Santi Béjar <sbejar@gmail.com>\n>\n> Perhaps it would be more useful to have a flag for git-describe to\n> describe not the (HEAD) commit but your working copy (thus HEAD + check\n> for the dirtyness).\n>\n\nSure.\n"}]}