Correct priority of lightweight tags in git-describe.
commitcf69fd49ec815780080dc6a4ee237eee5ffe8745
authorShawn O. Pearce <spearce@spearce.org>
Sun, 14 Jan 2007 09:37:44 +0000 (14 04:37 -0500)
committerJunio C Hamano <junkio@cox.net>
Mon, 15 Jan 2007 05:17:27 +0000 (14 21:17 -0800)
tree7515ec68138f1833e7139c465050e847e8f3d471
parent5312ab11fbf7bac28b671510ac3734a3e604d9fa
Correct priority of lightweight tags in git-describe.

We really want to always favor an annotated tag over a lightweight
tag when describing a commit.  Unfortunately git-describe wasn't
doing this as it was favoring the depth attribute of a possible_tag
over the priority.  Now priority is the highest sort and we only
consider a lightweight tag if no annotated tags were identified.

Rather than searching for the minimum tag using a simple loop we
now sort them using a stable sort algorithm, this way the possible
tags display in order if --debug gets used.  The stable sort helps
to preseve the inherit topology/date order that we obtain during
our search loop.

This fix allows the tests in t6120-describe.sh to pass.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-describe.c