From: "Shawn O. Pearce" <spearce@spearce.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, "Pierre Habouzit" <madcoder@debian.org>,
"Erez Zilber" <erezzi.list@gmail.com>,
"Uwe Kleine-K�nig" <ukleinek@strlen.de>
Subject: [PATCH v2] describe: Make --tags and --all match lightweight tags more often
Date: Mon, 13 Oct 2008 07:39:46 -0700 [thread overview]
Message-ID: <20081013143946.GP4856@spearce.org> (raw)
In-Reply-To: <20081010171217.GB29028@artemis.corp>
If the caller supplies --tags they want the lightweight, unannotated
tags to be searched for a match. If a lightweight tag is closer
in the history, it should be matched, even if an annotated tag is
reachable further back in the commit chain.
The same applies with --all when matching any other type of ref.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Acked-By: Uwe Kleine-K�nig <ukleinek@strlen.de>
---
Changes since v1 of this patch:
- Documentation updates were added.
- Comment for "tags" flag modified per Uwe's suggestion.
Documentation/git-describe.txt | 9 +++++++--
builtin-describe.c | 6 ++----
t/t6120-describe.sh | 8 ++++----
3 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/Documentation/git-describe.txt b/Documentation/git-describe.txt
index c4dbc2a..40e061f 100644
--- a/Documentation/git-describe.txt
+++ b/Documentation/git-describe.txt
@@ -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
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 annoated tags
+see the -a and -s options to linkgit:git-tag[1].
OPTIONS
-------
@@ -26,11 +29,13 @@ 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 ec404c8..d2cfb1b 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -15,8 +15,8 @@ static const char * const describe_usage[] = {
};
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;
@@ -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 *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 16cc635..e6c9e59 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -91,10 +91,10 @@ check_describe D-* HEAD^^
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^
--
1.6.0.2.706.g340fc
--
Shawn.
next prev parent reply other threads:[~2008-10-13 14:41 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-28 13:48 git-describe doesn't show the most recent tag Erez Zilber
2008-09-28 13:55 ` Pierre Habouzit
2008-09-28 14:29 ` Erez Zilber
2008-09-28 14:39 ` Pierre Habouzit
2008-09-28 15:03 ` Pierre Habouzit
2008-09-28 15:12 ` [PATCH] doc: enhance git describe --tags help Pierre Habouzit
2008-09-29 15:01 ` Shawn O. Pearce
2008-09-30 8:39 ` Pierre Habouzit
2008-10-10 16:59 ` [RFC PATCH] describe: Make --tags and --all match lightweight tags more often Shawn O. Pearce
2008-10-10 17:12 ` Pierre Habouzit
2008-10-10 18:18 ` Junio C Hamano
2008-10-13 14:32 ` Shawn O. Pearce
2008-10-13 14:39 ` Shawn O. Pearce [this message]
2008-10-15 12:54 ` [PATCH v2] " Santi Béjar
2008-10-11 22:47 ` [RFC PATCH] " Andreas Ericsson
2008-10-12 18:00 ` Shawn O. Pearce
2008-10-12 18:13 ` Andreas Ericsson
2008-10-12 18:29 ` Uwe Kleine-König
2008-09-30 9:56 ` [PATCH] doc: enhance git describe --tags help Uwe Kleine-König
2008-09-30 10:09 ` Andreas Ericsson
2008-09-30 19:04 ` Shawn O. Pearce
2008-09-30 22:14 ` Uwe Kleine-König
2008-09-30 22:26 ` Shawn O. Pearce
2008-10-15 20:05 ` Uwe Kleine-König
2008-09-28 15:05 ` git-describe doesn't show the most recent tag Erez Zilber
2008-09-28 14:51 ` Andreas Ericsson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081013143946.GP4856@spearce.org \
--to=spearce@spearce.org \
--cc=erezzi.list@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=madcoder@debian.org \
--cc=ukleinek@strlen.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).