Always perfer annotated tags in git-describe.
Several people have suggested that its always better to describe a commit using an annotated tag, and to only use a lightweight tag if absolutely no annotated tag matches the input commit. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
c14261eaa2
commit
dccd0c2abd
@ -138,6 +138,7 @@ static void describe(const char *arg, int last_one)
|
|||||||
commit_list_insert(cmit, &list);
|
commit_list_insert(cmit, &list);
|
||||||
while (list) {
|
while (list) {
|
||||||
struct commit *c = pop_commit(&list);
|
struct commit *c = pop_commit(&list);
|
||||||
|
struct commit_list *parents = c->parents;
|
||||||
n = match(c);
|
n = match(c);
|
||||||
if (n) {
|
if (n) {
|
||||||
struct possible_tag *p = xmalloc(sizeof(*p));
|
struct possible_tag *p = xmalloc(sizeof(*p));
|
||||||
@ -148,17 +149,17 @@ static void describe(const char *arg, int last_one)
|
|||||||
else
|
else
|
||||||
all_matches = p;
|
all_matches = p;
|
||||||
cur_match = p;
|
cur_match = p;
|
||||||
} else {
|
if (n->prio == 2)
|
||||||
struct commit_list *parents = c->parents;
|
continue;
|
||||||
while (parents) {
|
}
|
||||||
struct commit *p = parents->item;
|
while (parents) {
|
||||||
parse_commit(p);
|
struct commit *p = parents->item;
|
||||||
if (!(p->object.flags & SEEN)) {
|
parse_commit(p);
|
||||||
p->object.flags |= SEEN;
|
if (!(p->object.flags & SEEN)) {
|
||||||
insert_by_date(p, &list);
|
p->object.flags |= SEEN;
|
||||||
}
|
insert_by_date(p, &list);
|
||||||
parents = parents->next;
|
|
||||||
}
|
}
|
||||||
|
parents = parents->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +182,8 @@ static void describe(const char *arg, int last_one)
|
|||||||
while ((!min_match || cur_match->depth < min_match->depth)
|
while ((!min_match || cur_match->depth < min_match->depth)
|
||||||
&& get_revision(&revs))
|
&& get_revision(&revs))
|
||||||
cur_match->depth++;
|
cur_match->depth++;
|
||||||
if (!min_match || cur_match->depth < min_match->depth)
|
if (!min_match || (cur_match->depth < min_match->depth
|
||||||
|
&& cur_match->name->prio >= min_match->name->prio))
|
||||||
min_match = cur_match;
|
min_match = cur_match;
|
||||||
free_commit_list(revs.commits);
|
free_commit_list(revs.commits);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user