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

6 messages from 2008-12-26 to 2008-12-27. Participants: Shawn O. Pearce, Junio C Hamano, Miklos Vajna.
Thread: https://gitlist.dev/t/16875

## Shawn O. Pearce, 2008-12-26 22:02

Subject: [PATCH] describe: Avoid unnecessary warning when using --all
Message-ID: <20081226220201.GA20516@spearce.org>
URL: https://gitlist.dev/e/20081226220201.GA20516%40spearce.org

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

```

## Junio C Hamano, 2008-12-27 00:18

Subject: Re: [PATCH] describe: Avoid unnecessary warning when using --all
Message-ID: <7vmyeijws2.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vmyeijws2.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20081226220201.GA20516@spearce.org>

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

```

## Shawn O. Pearce, 2008-12-27 00:26

Subject: Re: [PATCH] describe: Avoid unnecessary warning when using --all
Message-ID: <20081227002627.GA21386@spearce.org>
URL: https://gitlist.dev/e/20081227002627.GA21386%40spearce.org
In-Reply-To: <7vmyeijws2.fsf@gitster.siamese.dyndns.org>

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

```

## Miklos Vajna, 2008-12-27 00:38

Subject: Re: [PATCH] describe: Avoid unnecessary warning when using --all
Message-ID: <20081227003859.GU21154@genesis.frugalware.org>
URL: https://gitlist.dev/e/20081227003859.GU21154%40genesis.frugalware.org
In-Reply-To: <20081227002627.GA21386@spearce.org>

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

```

## Junio C Hamano, 2008-12-27 00:40

Subject: Re: [PATCH] describe: Avoid unnecessary warning when using --all
Message-ID: <7v63l6jvrl.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v63l6jvrl.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20081227002627.GA21386@spearce.org>

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

```

## Miklos Vajna, 2008-12-27 00:40

Subject: Re: [PATCH] describe: Avoid unnecessary warning when using --all
Message-ID: <20081227004019.GV21154@genesis.frugalware.org>
URL: https://gitlist.dev/e/20081227004019.GV21154%40genesis.frugalware.org
In-Reply-To: <20081227003859.GU21154@genesis.frugalware.org>

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

```
