@matheusbsbs / matheus-bagliano / commits / 7a0d61bb45
Fork 0

describe: do not use unannotated tag even if exact match

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>

Thomas Rast committed Nov 18, 2009 at 14:32 UTC 7a0d61bb45055cacf85111e7c48dfb9054b0abb0
2 files changed +7 -1
builtin-describe.c
+1 -1
@@ -200,7 +200,7 @@ static void describe(const char *arg, int last_one)
200 die("%s is not a valid '%s' object", arg, commit_type);
201
202 n = cmit->util;
203 - if (n) {
203 + if (n && (tags || all || n->prio == 2)) {
204 /*
205 * Exact match to an existing ref.
206 */
t/t6120-describe.sh
+6
@@ -92,12 +92,18 @@ check_describe A-* HEAD^
92 check_describe D-* HEAD^^
93 check_describe A-* HEAD^^2
94 check_describe B HEAD^^2^
95 +check_describe D-* HEAD^^^
96
97 check_describe c-* --tags HEAD
98 check_describe c-* --tags HEAD^
99 check_describe e-* --tags HEAD^^
100 check_describe c-* --tags HEAD^^2
101 check_describe B --tags HEAD^^2^
102 +check_describe e --tags HEAD^^^
103 +
104 +check_describe heads/master --all HEAD
105 +check_describe tags/c-* --all HEAD^
106 +check_describe tags/e --all HEAD^^^
107
108 check_describe B-0-* --long HEAD^^2^
109 check_describe A-3-* --long HEAD^^2