author | Junio C Hamano <gitster@pobox.com> | |
Sun, 19 Oct 2008 23:06:39 +0000 (16:06 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 19 Oct 2008 23:06:39 +0000 (16:06 -0700) |
* sp/describe-lwtag:
describe: Make --tags and --all match lightweight tags more often
describe: Make --tags and --all match lightweight tags more often
Documentation/git-describe.txt | patch | blob | history | |
builtin-describe.c | patch | blob | history | |
t/t6120-describe.sh | patch | blob | history |
index c4dbc2ae342833561080f7a18a93bcf5ac5a0dd3..3d79f05995d28214f68640dd3f693033dff03547 100644 (file)
additional commits on top of the tagged object and the
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
-------
--all::
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::
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::
Instead of finding the tag that predates the commit, find
diff --git a/builtin-describe.c b/builtin-describe.c
index ec404c839b6542deb4e15ca342fd3c0afbbedd2e..d2cfb1b0837ffd1ab3b1f69e8dee0ffa36f2e1ab 100644 (file)
--- a/builtin-describe.c
+++ b/builtin-describe.c
};
static int debug; /* Display lots of verbose info */
-static int all; /* Default to annotated tags only */
-static int tags; /* But allow any tags if --tags is specified */
+static int all; /* Any valid ref can be used */
+static int tags; /* Allow lightweight tags */
static int longformat;
static int abbrev = DEFAULT_ABBREV;
static int max_candidates = 10;
{
struct possible_tag *a = (struct possible_tag *)a_;
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)
return a->depth - b->depth;
if (a->found_order != b->found_order)
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 16cc63581383360d6dc92a69f646890eb00e580a..e6c9e59b617f4eaaa1148ed29b4ca92116bdf0c2 100755 (executable)
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
check_describe A-* HEAD^^2
check_describe B HEAD^^2^
-check_describe A-* --tags HEAD
-check_describe A-* --tags HEAD^
-check_describe D-* --tags HEAD^^
-check_describe A-* --tags HEAD^^2
+check_describe c-* --tags HEAD
+check_describe c-* --tags HEAD^
+check_describe e-* --tags HEAD^^
+check_describe c-* --tags HEAD^^2
check_describe B --tags HEAD^^2^
check_describe B-0-* --long HEAD^^2^