threads / patch / 13784

patchdescribe match pattern for soft tags too

Subject: [PATCH] describe match pattern for soft tags too

## tl;dr

6 messages between Jun 3, 2008 and Jun 4, 2008. Diffs are folded; open one to read it.

replies: 5people: 4as markdown or json

Michael Dressel· Jun 3, 2008, 17:59 UTC · lore
So far git describe --match <pattern> would apply the <pattern> only
to tag objects not to soft tags. This change make describe apply
the <pattern> to soft tags too.
---
  builtin-describe.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
Show changes to builtin-describe.c +2 −2
diff --git a/builtin-describe.c b/builtin-describe.c
index df554b3..a1b8251 100644
--- a/builtin-describe.c
+++ b/builtin-describe.c
@@ -82,10 +82,10 @@ static int get_name(const char *path, const unsigned char *sha1, int flag, void
  	if (might_be_tag) {
  		if (is_tag) {
  			prio = 2;
-			if (pattern && fnmatch(pattern, path + 10, 0))
-				prio = 0;
  		} else
  			prio = 1;
+		if (pattern && fnmatch(pattern, path + 10, 0))
+			prio = 0;
  	}
  	else
  		prio = 0;
-- 
1.5.5.3
Johannes Schindelin· Jun 3, 2008, 20:24 UTC · re: Michael Dressel · lore

Re: [PATCH] describe match pattern for soft tags too

Hi,
On Tue, 3 Jun 2008, Michael Dressel wrote:
> So far git describe --match <pattern> would apply the <pattern> only
> to tag objects not to soft tags.
And I thought that was what --tags was for.

Ciao, Dscho

Shawn O. Pearce· Jun 3, 2008, 22:42 UTC · re: Johannes Schindelin · lore

Re: [PATCH] describe match pattern for soft tags too

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 6 quoted lines
> On Tue, 3 Jun 2008, Michael Dressel wrote:
> 
> > So far git describe --match <pattern> would apply the <pattern> only
> > to tag objects not to soft tags.
> 
> And I thought that was what --tags was for.

Yes. However there is a bug in git-describe's implementation; --match only tested on annotated tags. The test was buried inside of the block that handles the annotated case. Michael's patch pulls this test outside where it can apply to lightweight tags when --tags is included on the command line.

-- 
Shawn.
Shawn O. Pearce· Jun 3, 2008, 22:48 UTC · re: Michael Dressel · lore

Re: [PATCH] describe match pattern for soft tags too

Michael Dressel <MichaelTiloDressel@t-online.de> wrote:
> 
> So far git describe --match <pattern> would apply the <pattern> only
> to tag objects not to soft tags. This change make describe apply
> the <pattern> to soft tags too.
Whoops.
Signed-off-by tag?
Assuming you supply Junio an SBO tag,
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Show 22 quoted lines
> ---
>  builtin-describe.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/builtin-describe.c b/builtin-describe.c
> index df554b3..a1b8251 100644
> --- a/builtin-describe.c
> +++ b/builtin-describe.c
> @@ -82,10 +82,10 @@ static int get_name(const char *path, const unsigned 
> char *sha1, int flag, void
>  	if (might_be_tag) {
>  		if (is_tag) {
>  			prio = 2;
> -			if (pattern && fnmatch(pattern, path + 10, 0))
> -				prio = 0;
>  		} else
>  			prio = 1;
> +		if (pattern && fnmatch(pattern, path + 10, 0))
> +			prio = 0;
>  	}
>  	else
>  		prio = 0;
-- 
Shawn.
Junio C Hamano· Jun 4, 2008, 06:04 UTC · re: Shawn O. Pearce · lore

Re: [PATCH] describe match pattern for soft tags too

"Shawn O. Pearce" <spearce@spearce.org> writes:
Show 7 quoted lines
> Michael Dressel <MichaelTiloDressel@t-online.de> wrote:
>> 
>> So far git describe --match <pattern> would apply the <pattern> only
>> to tag objects not to soft tags. This change make describe apply
>> the <pattern> to soft tags too.
>
> Whoops.

Micronit. They are called "lightweight" tags. There aren't any hard tags either.

Show 5 quoted lines
> Signed-off-by tag?
>
> Assuming you supply Junio an SBO tag,
>
> Acked-by: Shawn O. Pearce <spearce@spearce.org>
Thanks for proofreading.
Michael Dressel· Jun 4, 2008, 19:06 UTC · re: Junio C Hamano · lore

Re: [PATCH] describe match pattern for soft tags too

On Tue, 3 Jun 2008, Junio C Hamano wrote:
Show 20 quoted lines
> "Shawn O. Pearce" <spearce@spearce.org> writes:
>
>> Michael Dressel <MichaelTiloDressel@t-online.de> wrote:
>>>
>>> So far git describe --match <pattern> would apply the <pattern> only
>>> to tag objects not to soft tags. This change make describe apply
>>> the <pattern> to soft tags too.
>>
>> Whoops.
>
> Micronit.  They are called "lightweight" tags.  There aren't any hard tags
> either.
>
>> Signed-off-by tag?
>>
>> Assuming you supply Junio an SBO tag,
>>
>> Acked-by: Shawn O. Pearce <spearce@spearce.org>
>
> Thanks for proofreading.

Thanks for the comments. I will sent in a new patch see:

[PATCH] describe: match pattern for lightweight tags too

Cheers, Michael

← back to recent threads