1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-10-30 13:57:54 +01:00

Merge branch 'sp/describe-lwtag'

* sp/describe-lwtag:
  describe: Make --tags and --all match lightweight tags more often
This commit is contained in:
Junio C Hamano 2008-10-19 16:06:39 -07:00
commit 18e143487d
3 changed files with 13 additions and 10 deletions

View file

@ -18,6 +18,9 @@ shown. Otherwise, it suffixes the tag name with the number of
additional commits on top of the tagged object and the additional commits on top of the tagged object and the
abbreviated object name of the most recent commit. abbreviated object name of the most recent commit.
By default (without --all or --tags) `git describe` only shows
annotated tags. For more information about creating annotated tags
see the -a and -s options to linkgit:git-tag[1].
OPTIONS OPTIONS
------- -------
@ -26,11 +29,13 @@ OPTIONS
--all:: --all::
Instead of using only the annotated tags, use any ref Instead of using only the annotated tags, use any ref
found in `.git/refs/`. found in `.git/refs/`. This option enables matching
any known branch, remote branch, or lightweight tag.
--tags:: --tags::
Instead of using only the annotated tags, use any tag Instead of using only the annotated tags, use any tag
found in `.git/refs/tags`. found in `.git/refs/tags`. This option enables matching
a lightweight (non-annotated) tag.
--contains:: --contains::
Instead of finding the tag that predates the commit, find Instead of finding the tag that predates the commit, find

View file

@ -15,8 +15,8 @@ static const char * const describe_usage[] = {
}; };
static int debug; /* Display lots of verbose info */ static int debug; /* Display lots of verbose info */
static int all; /* Default to annotated tags only */ static int all; /* Any valid ref can be used */
static int tags; /* But allow any tags if --tags is specified */ static int tags; /* Allow lightweight tags */
static int longformat; static int longformat;
static int abbrev = DEFAULT_ABBREV; static int abbrev = DEFAULT_ABBREV;
static int max_candidates = 10; static int max_candidates = 10;
@ -112,8 +112,6 @@ static int compare_pt(const void *a_, const void *b_)
{ {
struct possible_tag *a = (struct possible_tag *)a_; struct possible_tag *a = (struct possible_tag *)a_;
struct possible_tag *b = (struct possible_tag *)b_; struct possible_tag *b = (struct possible_tag *)b_;
if (a->name->prio != b->name->prio)
return b->name->prio - a->name->prio;
if (a->depth != b->depth) if (a->depth != b->depth)
return a->depth - b->depth; return a->depth - b->depth;
if (a->found_order != b->found_order) if (a->found_order != b->found_order)

View file

@ -91,10 +91,10 @@ check_describe D-* HEAD^^
check_describe A-* HEAD^^2 check_describe A-* HEAD^^2
check_describe B HEAD^^2^ check_describe B HEAD^^2^
check_describe A-* --tags HEAD check_describe c-* --tags HEAD
check_describe A-* --tags HEAD^ check_describe c-* --tags HEAD^
check_describe D-* --tags HEAD^^ check_describe e-* --tags HEAD^^
check_describe A-* --tags HEAD^^2 check_describe c-* --tags HEAD^^2
check_describe B --tags HEAD^^2^ check_describe B --tags HEAD^^2^
check_describe B-0-* --long HEAD^^2^ check_describe B-0-* --long HEAD^^2^