{"thread":{"id":"6365","subject":"[PATCH 1/4] Always perfer annotated tags in git-describe.","startedAt":"2007-01-13T22:27:52Z","lastAt":"2007-01-14T21:36:28Z","messageCount":3,"participants":["Shawn O. Pearce","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"31660","messageId":"20070113222752.GA18011@spearce.org","threadId":"6365","inReplyTo":null,"subject":"[PATCH 1/4] Always perfer annotated tags in git-describe.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2007-01-13T22:27:52Z","receivedAt":"2007-01-13T22:27:52Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Several people have suggested that its always better to describe\na commit using an annotated tag, and to only use a lightweight tag\nif absolutely no annotated tag matches the input commit.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n builtin-describe.c |   24 +++++++++++++-----------\n 1 files changed, 13 insertions(+), 11 deletions(-)\n\ndiff --git a/builtin-describe.c b/builtin-describe.c\nindex a8c98ce..ad672aa 100644\n--- a/builtin-describe.c\n+++ b/builtin-describe.c\n@@ -138,6 +138,7 @@ static void describe(const char *arg, int last_one)\n \tcommit_list_insert(cmit, &list);\n \twhile (list) {\n \t\tstruct commit *c = pop_commit(&list);\n+\t\tstruct commit_list *parents = c->parents;\n \t\tn = match(c);\n \t\tif (n) {\n \t\t\tstruct possible_tag *p = xmalloc(sizeof(*p));\n@@ -148,17 +149,17 @@ static void describe(const char *arg, int last_one)\n \t\t\telse\n \t\t\t\tall_matches = p;\n \t\t\tcur_match = p;\n-\t\t} else {\n-\t\t\tstruct commit_list *parents = c->parents;\n-\t\t\twhile (parents) {\n-\t\t\t\tstruct commit *p = parents->item;\n-\t\t\t\tparse_commit(p);\n-\t\t\t\tif (!(p->object.flags & SEEN)) {\n-\t\t\t\t\tp->object.flags |= SEEN;\n-\t\t\t\t\tinsert_by_date(p, &list);\n-\t\t\t\t}\n-\t\t\t\tparents = parents->next;\n+\t\t\tif (n->prio == 2)\n+\t\t\t\tcontinue;\n+\t\t}\n+\t\twhile (parents) {\n+\t\t\tstruct commit *p = parents->item;\n+\t\t\tparse_commit(p);\n+\t\t\tif (!(p->object.flags & SEEN)) {\n+\t\t\t\tp->object.flags |= SEEN;\n+\t\t\t\tinsert_by_date(p, &list);\n \t\t\t}\n+\t\t\tparents = parents->next;\n \t\t}\n \t}\n \n@@ -181,7 +182,8 @@ static void describe(const char *arg, int last_one)\n \t\twhile ((!min_match || cur_match->depth < min_match->depth)\n \t\t\t&& get_revision(&revs))\n \t\t\tcur_match->depth++;\n-\t\tif (!min_match || cur_match->depth < min_match->depth)\n+\t\tif (!min_match || (cur_match->depth < min_match->depth\n+\t\t\t&& cur_match->name->prio >= min_match->name->prio))\n \t\t\tmin_match = cur_match;\n \t\tfree_commit_list(revs.commits);\n \t}\n-- \n1.5.0.rc1.g4494\n"},{"id":"31706","messageId":"7v8xg5h19z.fsf@assigned-by-dhcp.cox.net","threadId":"6365","inReplyTo":"20070113222752.GA18011@spearce.org","subject":"Re: [PATCH 1/4] Always perfer annotated tags in git-describe.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-14T19:11:04Z","receivedAt":"2007-01-14T19:11:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Shawn O. Pearce\" <spearce@spearce.org> writes:\n\n> @@ -148,17 +149,17 @@ static void describe(const char *arg, int last_one)\n>  \t\t\telse\n>  \t\t\t\tall_matches = p;\n>  \t\t\tcur_match = p;\n> +\t\t\tif (n->prio == 2)\n> +\t\t\t\tcontinue;\n\nWhen you do not have _any_ annotated tag but you do have\nlightweight tags, wouldn't this make the traversal go all the\nway down to root?\n"},{"id":"31709","messageId":"7vd55hffz7.fsf@assigned-by-dhcp.cox.net","threadId":"6365","inReplyTo":"7v8xg5h19z.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 1/4] Always perfer annotated tags in git-describe.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-14T21:36:28Z","receivedAt":"2007-01-14T21:36:28Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <junkio@cox.net> writes:\n\n> \"Shawn O. Pearce\" <spearce@spearce.org> writes:\n>\n>> @@ -148,17 +149,17 @@ static void describe(const char *arg, int last_one)\n>>  \t\t\telse\n>>  \t\t\t\tall_matches = p;\n>>  \t\t\tcur_match = p;\n>> +\t\t\tif (n->prio == 2)\n>> +\t\t\t\tcontinue;\n>\n> When you do not have _any_ annotated tag but you do have\n> lightweight tags, wouldn't this make the traversal go all the\n> way down to root?\n\nThis is irrelevant now.  Please ignore.\n"}]}