threads / patch / 16875

patchdescribe: Avoid unnecessary warning when using --all

Subject: [PATCH] describe: Avoid unnecessary warning when using --all

## tl;dr

6 messages between Dec 26, 2008 and Dec 27, 2008. Diffs are folded; open one to read it.

replies: 5people: 3as markdown or json

Shawn O. Pearce· Dec 26, 2008, 22:02 UTC · lore

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(-)
Show changes to 2 files +7 −1

builtin-describe.c, t/t6120-describe.sh

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
Junio C Hamano· Dec 27, 2008, 00:18 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] describe: Avoid unnecessary warning when using --all

"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 14 quoted lines
> 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.

Shawn O. Pearce· Dec 27, 2008, 00:26 UTC · re: Junio C Hamano · lore

Re: [PATCH] describe: Avoid unnecessary warning when using --all

Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> "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.
Miklos Vajna· Dec 27, 2008, 00:38 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] describe: Avoid unnecessary warning when using --all

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
Miklos Vajna· Dec 27, 2008, 00:40 UTC · re: Miklos Vajna · lore

Re: [PATCH] describe: Avoid unnecessary warning when using --all

On Sat, Dec 27, 2008 at 01:38:59AM +0100, Miklos Vajna <vmiklos@frugalware.org> wrote:
Show 6 quoted lines
> 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.
Junio C Hamano· Dec 27, 2008, 00:40 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] describe: Avoid unnecessary warning when using --all

"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 7 quoted lines
> 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.

← back to recent threads