{"thread":{"id":"5625","subject":"[PATCH] describe: fall back to 'HEAD' if no appropriate tag exists","startedAt":"2006-09-20T21:25:07Z","lastAt":"2006-09-21T07:43:46Z","messageCount":4,"participants":["Johannes Schindelin","Junio C Hamano","Andy Whitcroft"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"27288","messageId":"Pine.LNX.4.63.0609202324210.19042@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5625","inReplyTo":null,"subject":"[PATCH] describe: fall back to 'HEAD' if no appropriate tag exists","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-09-20T21:25:07Z","receivedAt":"2006-09-20T21:25:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nNow, if no tag exists to say something like '<tag>-gfffffff', say\n'HEAD-gfffffff' instead of erroring out.\n\nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n---\n describe.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/describe.c b/describe.c\nindex ab192f8..8b08a3f 100644\n--- a/describe.c\n+++ b/describe.c\n@@ -136,7 +136,7 @@ static void describe(const char *arg, in\n \t\t\treturn;\n \t\t}\n \t}\n-\tdie(\"cannot describe '%s'\", sha1_to_hex(cmit->object.sha1));\n+\tprintf(\"HEAD-g%s\\n\", find_unique_abbrev(cmit->object.sha1, abbrev));\n }\n \n int main(int argc, char **argv)\n-- \n1.4.2.1.ga0df5-dirty\n"},{"id":"27306","messageId":"7v8xkef97b.fsf@assigned-by-dhcp.cox.net","threadId":"5625","inReplyTo":"Pine.LNX.4.63.0609202324210.19042@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-09-20T22:46:00Z","receivedAt":"2006-09-20T22:46:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Now, if no tag exists to say something like '<tag>-gfffffff', say\n> 'HEAD-gfffffff' instead of erroring out.\n>\n> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n> ---\n>  describe.c |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/describe.c b/describe.c\n> index ab192f8..8b08a3f 100644\n> --- a/describe.c\n> +++ b/describe.c\n> @@ -136,7 +136,7 @@ static void describe(const char *arg, in\n>  \t\t\treturn;\n>  \t\t}\n>  \t}\n> -\tdie(\"cannot describe '%s'\", sha1_to_hex(cmit->object.sha1));\n> +\tprintf(\"HEAD-g%s\\n\", find_unique_abbrev(cmit->object.sha1, abbrev));\n>  }\n\nHmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm.\n\nAt least with tags, the user can assume NAME-gREV means commit\nwhose abbrev is REV that is descendant of NAME.  HEAD is not\nnecessarily so.\n\nHaving said that, in order to avoid barfing, we have to have\nsomething there, and HEAD is already special in many aspects\nanyway (e.g. by only saying HEAD you cannot tell which branch's\ntip you are talking about), it might be good enough.\n\nI am just wondering if there is some other obvious substitute\nthat is better than HEAD.  \"GIT-g%s\" is not it (\"g\" already\nstands for GIT).\n\nAnother possibility is just to do\n\n        puts(sha1_to_hex(cmit->object.sha1))\n\nin this case.  I tend to like that better somehow; it makes\nthings more explicit.\n"},{"id":"27308","messageId":"Pine.LNX.4.63.0609210051570.19042@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"5625","inReplyTo":"7v8xkef97b.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-09-20T22:53:16Z","receivedAt":"2006-09-20T22:53:16Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 20 Sep 2006, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Now, if no tag exists to say something like '<tag>-gfffffff', say\n> > 'HEAD-gfffffff' instead of erroring out.\n> \n> Another possibility is just to do\n> \n>         puts(sha1_to_hex(cmit->object.sha1))\n> \n> in this case.\n\nOkay. Could we have the abbreviated sha1, at least?\n\nCiao,\nDscho\n"},{"id":"27347","messageId":"451242B2.7090508@shadowen.org","threadId":"5625","inReplyTo":"7v8xkef97b.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] describe: fall back to 'HEAD' if no appropriate tag exists","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2006-09-21T07:43:46Z","receivedAt":"2006-09-21T07:43:46Z","isPatch":true,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"Junio C Hamano wrote:\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n>> Now, if no tag exists to say something like '<tag>-gfffffff', say\n>> 'HEAD-gfffffff' instead of erroring out.\n>>\n>> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n>> ---\n>>  describe.c |    2 +-\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/describe.c b/describe.c\n>> index ab192f8..8b08a3f 100644\n>> --- a/describe.c\n>> +++ b/describe.c\n>> @@ -136,7 +136,7 @@ static void describe(const char *arg, in\n>>  \t\t\treturn;\n>>  \t\t}\n>>  \t}\n>> -\tdie(\"cannot describe '%s'\", sha1_to_hex(cmit->object.sha1));\n>> +\tprintf(\"HEAD-g%s\\n\", find_unique_abbrev(cmit->object.sha1, abbrev));\n>>  }\n> \n> Hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm.\n> \n> At least with tags, the user can assume NAME-gREV means commit\n> whose abbrev is REV that is descendant of NAME.  HEAD is not\n> necessarily so.\n> \n> Having said that, in order to avoid barfing, we have to have\n> something there, and HEAD is already special in many aspects\n> anyway (e.g. by only saying HEAD you cannot tell which branch's\n> tip you are talking about), it might be good enough.\n> \n> I am just wondering if there is some other obvious substitute\n> that is better than HEAD.  \"GIT-g%s\" is not it (\"g\" already\n> stands for GIT).\n> \n> Another possibility is just to do\n> \n>         puts(sha1_to_hex(cmit->object.sha1))\n> \n> in this case.  I tend to like that better somehow; it makes\n> things more explicit.\n\nHeh, we've just been putting together 'versioner' for some software and\nwhen git-describe fails we substitute in the complete sha1 at that\npoint.  Based mostly on the \"who'd release something versioned without\ntagging anyhow\".  I think either the full sha1 or _just_ the gNNNNN\nwithout prefix would be fine.\n\n-apw\n"}]}