]> Pileus Git - ~andy/git/commitdiff
describe: do not use unannotated tag even if exact match
authorThomas Rast <trast@student.ethz.ch>
Wed, 18 Nov 2009 13:32:26 +0000 (14:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 Nov 2009 05:58:11 +0000 (21:58 -0800)
4d23660 (describe: when failing, tell the user about options that
work, 2009-10-28) forgot to update the shortcut path where the code
detected and used a possible exact match.  This means that an
unannotated tag on HEAD would be used by 'git describe'.

Guard this code path against the new circumstances, where unannotated
tags can be present in ->util even if we're not actually planning to
use them.

While there, also add some tests for --all.

Reported by 'yashi' on IRC.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-describe.c
t/t6120-describe.sh

index d4efb10ddfddedb1671fa91130e5fe78400ad154..71be2a9364748668996696f6c74057dba43315b5 100644 (file)
@@ -200,7 +200,7 @@ static void describe(const char *arg, int last_one)
                die("%s is not a valid '%s' object", arg, commit_type);
 
        n = cmit->util;
-       if (n) {
+       if (n && (tags || all || n->prio == 2)) {
                /*
                 * Exact match to an existing ref.
                 */
index c050f94bc626c340d27ebfca824116f12b4fda26..065deadc29eb3838f391ce758c4b188249dc87f9 100755 (executable)
@@ -92,12 +92,18 @@ check_describe A-* HEAD^
 check_describe D-* HEAD^^
 check_describe A-* HEAD^^2
 check_describe B HEAD^^2^
+check_describe D-* HEAD^^^
 
 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 e --tags HEAD^^^
+
+check_describe heads/master --all HEAD
+check_describe tags/c-* --all HEAD^
+check_describe tags/e --all HEAD^^^
 
 check_describe B-0-* --long HEAD^^2^
 check_describe A-3-* --long HEAD^^2