git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] describe: Avoid unnecessary warning when using --all
@ 2008-12-26 22:02 Shawn O. Pearce
  2008-12-27  0:18 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Shawn O. Pearce @ 2008-12-26 22:02 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: demerphq, rene.scharfe, git

In 212945d4 ("Teach git-describe to verify annotated tag names
before output") git-describe learned how to output a warning if
an annotated tag object was matched but its internal name doesn't
match the local ref name.

However, "git describe --all" causes the local ref name to be
prefixed with "tags/", so we need to skip over this prefix before
comparing the local ref name with the name recorded inside of the
tag object.

Patch-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Shawn O. Pearce <sop@google.com>
---
 IMHO, suitable for maint...

 builtin-describe.c  |    2 +-
 t/t6120-describe.sh |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/builtin-describe.c b/builtin-describe.c
index d2cfb1b..3a007ed 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -158,7 +158,7 @@ static void display_name(struct commit_name *n)
 		n->tag = lookup_tag(n->sha1);
 		if (!n->tag || parse_tag(n->tag) || !n->tag->tag)
 			die("annotated tag %s not available", n->path);
-		if (strcmp(n->tag->tag, n->path))
+		if (strcmp(n->tag->tag, all ? n->path + 5 : n->path))
 			warning("tag '%s' is really '%s' here", n->tag->tag, n->path);
 	}
 
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index e6c9e59..8c7e081 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -100,6 +100,12 @@ check_describe B --tags HEAD^^2^
 check_describe B-0-* --long HEAD^^2^
 check_describe A-3-* --long HEAD^^2
 
+: >err.expect
+check_describe A --all A^0
+test_expect_success 'no warning was displayed for A' '
+	test_cmp err.expect err.actual
+'
+
 test_expect_success 'rename tag A to Q locally' '
 	mv .git/refs/tags/A .git/refs/tags/Q
 '
-- 
1.6.1.302.gccd4d

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-12-27  0:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-26 22:02 [PATCH] describe: Avoid unnecessary warning when using --all Shawn O. Pearce
2008-12-27  0:18 ` Junio C Hamano
2008-12-27  0:26   ` Shawn O. Pearce
2008-12-27  0:38     ` Miklos Vajna
2008-12-27  0:40       ` Miklos Vajna
2008-12-27  0:40     ` Junio C Hamano

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).