summaryrefslogtreecommitdiff
path: root/builtin-describe.c
diff options
context:
space:
mode:
authorShawn O. Pearce <spearce@spearce.org>2007-01-13 17:27:52 -0500
committerJunio C Hamano <junkio@cox.net>2007-01-14 21:17:27 -0800
commitdccd0c2abdb958daf6f168ba925b67441dc6be61 (patch)
tree77fceeab856a8c25d4e13c41f9533072f5a5c3da /builtin-describe.c
parentc14261eaa297504799e3b21ecbd751edbae912c0 (diff)
downloadgit-dccd0c2abdb958daf6f168ba925b67441dc6be61.tar.gz
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>
Diffstat (limited to 'builtin-describe.c')
-rw-r--r--builtin-describe.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/builtin-describe.c b/builtin-describe.c
index a8c98cea16..ad672aa8ee 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -138,6 +138,7 @@ static void describe(const char *arg, int last_one)
commit_list_insert(cmit, &list);
while (list) {
struct commit *c = pop_commit(&list);
+ struct commit_list *parents = c->parents;
n = match(c);
if (n) {
struct possible_tag *p = xmalloc(sizeof(*p));
@@ -148,17 +149,17 @@ static void describe(const char *arg, int last_one)
else
all_matches = p;
cur_match = p;
- } else {
- struct commit_list *parents = c->parents;
- while (parents) {
- struct commit *p = parents->item;
- parse_commit(p);
- if (!(p->object.flags & SEEN)) {
- p->object.flags |= SEEN;
- insert_by_date(p, &list);
- }
- parents = parents->next;
+ if (n->prio == 2)
+ continue;
+ }
+ while (parents) {
+ struct commit *p = parents->item;
+ parse_commit(p);
+ if (!(p->object.flags & SEEN)) {
+ p->object.flags |= SEEN;
+ insert_by_date(p, &list);
}
+ 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)
&& get_revision(&revs))
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;
free_commit_list(revs.commits);
}