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

* Re: [PATCH] describe: Avoid unnecessary warning when using --all
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-12-27  0:18 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: demerphq, rene.scharfe, git

"Shawn O. Pearce" <spearce@spearce.org> writes:

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

Yeah, do you prefer to be known as "sop" over "spearce" these days, by the
way?  It does not make a difference to me but I just noticed that Author
and S-o-b won't be matching, so I am just being curious.

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

* Re: [PATCH] describe: Avoid unnecessary warning when using --all
  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     ` Junio C Hamano
  0 siblings, 2 replies; 6+ messages in thread
From: Shawn O. Pearce @ 2008-12-27  0:26 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: demerphq, rene.scharfe, git

Junio C Hamano <gitster@pobox.com> wrote:
> "Shawn O. Pearce" <spearce@spearce.org> writes:
> > Patch-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
> > Signed-off-by: Shawn O. Pearce <sop@google.com>
> 
> Yeah, do you prefer to be known as "sop" over "spearce" these days, by the
> way?  It does not make a difference to me but I just noticed that Author
> and S-o-b won't be matching, so I am just being curious.

Whoops.

I use spearce@spearce.org for my Git work so the S-o-b line above
is wrong.  I just fixed it in my development repository on the work
system I used to make this patch.

Having two personalities is hard...  ;-)

Can you please amend to use my normal spearce@spearce.org address?

-- 
Shawn.

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

* Re: [PATCH] describe: Avoid unnecessary warning when using --all
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Miklos Vajna @ 2008-12-27  0:38 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Junio C Hamano, demerphq, rene.scharfe, git

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On Fri, Dec 26, 2008 at 04:26:27PM -0800, "Shawn O. Pearce" <spearce@spearce.org> wrote:
> Having two personalities is hard...  ;-)
> 
> Can you please amend to use my normal spearce@spearce.org address?

BTW, what Pasky/Nice did was to keep the author field the same, but
change the S-o-b line based on if they did it in their free time or in
work hours.

Like this one:

http://article.gmane.org/gmane.comp.version-control.git/97419

And the related thread:

http://thread.gmane.org/gmane.comp.version-control.git/96690/focus=96768

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: [PATCH] describe: Avoid unnecessary warning when using --all
  2008-12-27  0:26   ` Shawn O. Pearce
  2008-12-27  0:38     ` Miklos Vajna
@ 2008-12-27  0:40     ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-12-27  0:40 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: demerphq, rene.scharfe, git

"Shawn O. Pearce" <spearce@spearce.org> writes:

> I use spearce@spearce.org for my Git work so the S-o-b line above
> is wrong.  I just fixed it in my development repository on the work
> system I used to make this patch.
>
> Having two personalities is hard...  ;-)
>
> Can you please amend to use my normal spearce@spearce.org address?

Thanks, done.

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

* Re: [PATCH] describe: Avoid unnecessary warning when using --all
  2008-12-27  0:38     ` Miklos Vajna
@ 2008-12-27  0:40       ` Miklos Vajna
  0 siblings, 0 replies; 6+ messages in thread
From: Miklos Vajna @ 2008-12-27  0:40 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Junio C Hamano, demerphq, rene.scharfe, git

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

On Sat, Dec 27, 2008 at 01:38:59AM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
> On Fri, Dec 26, 2008 at 04:26:27PM -0800, "Shawn O. Pearce" <spearce@spearce.org> wrote:
> > Having two personalities is hard...  ;-)
> > 
> > Can you please amend to use my normal spearce@spearce.org address?
> 
> BTW, what Pasky/Nice did was to keep the author field the same, but

Err, I meant to mention Nico, sorry.

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[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).