# git describe relative to a given tag pattern

3 messages from 2012-02-06 to 2012-02-06. Participants: Adam Mercer, Junio C Hamano.
Thread: https://gitlist.dev/t/29563

## Adam Mercer, 2012-02-06 22:03

Subject: git describe relative to a given tag pattern
Message-ID: <CA+mfgz0VB9qMHHtoT76zCOiUaH=8egdMDrneQVRBug2waQsGAg@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2Bmfgz0VB9qMHHtoT76zCOiUaH%3D8egdMDrneQVRBug2waQsGAg%40mail.gmail.com

```
Hi

I'm trying to use git describe to describe the current status of my
tree with respect a given tag, or more specifically the latest tag
matching a specific pattern.

My repository has the following tags:

$ git tag -l lal-v*
lal-v6.6.0
lal-v6.6.0rc1
lal-v6.6.0rc2
lal-v6.6.1
lal-v6.6.2
$

And I want git describe to use the latest of these tags, so looking at
the git describe man page it seems that the --match option can allow
me to specify a pattern. This, however, doesn't seem to work:

$ git describe --match=lal-v* HEAD
fatal: No tags can describe 'cee13cbb25d0fa38f6e3bc6622bc751ebf35d2f0'.
Try --always, or create some tags.
$

quoting the pattern has no effect, what am I doing wrong here?

Cheers

Adam

PS: I'm using git-1.7.9

```

## Junio C Hamano, 2012-02-06 22:10

Subject: Re: git describe relative to a given tag pattern
Message-ID: <7vhaz362b8.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vhaz362b8.fsf%40alter.siamese.dyndns.org
In-Reply-To: <CA+mfgz0VB9qMHHtoT76zCOiUaH=8egdMDrneQVRBug2waQsGAg@mail.gmail.com>

```
Adam Mercer <ramercer@gmail.com> writes:

> $ git describe --match=lal-v* HEAD
> fatal: No tags can describe 'cee13cbb25d0fa38f6e3bc6622bc751ebf35d2f0'.

Perhaps Git is correct and your HEAD is not a descendant of any tag whose
name matches the pattern "lal-v*".

Here is how people can mimic the situation:

	$ git checkout v1.7.6~20
        $ git describe --match='v1.7.*' HEAD
        v1.7.6-rc0-3-g6c92972
        $ git describe --match='v1.7.[7-9]*' HEAD
        fatal: No tags can describe '6c92972d7f5ab247a8cab5e4b88cb281bf201970'.
	Try --always, or create some tags.

```

## Adam Mercer, 2012-02-06 22:18

Subject: Re: git describe relative to a given tag pattern
Message-ID: <CA+mfgz375mQUao8nF6dJYzd0_ui==25zKFj51fV5d9eEWrzc6Q@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2Bmfgz375mQUao8nF6dJYzd0_ui%3D%3D25zKFj51fV5d9eEWrzc6Q%40mail.gmail.com
In-Reply-To: <7vhaz362b8.fsf@alter.siamese.dyndns.org>

```
On Mon, Feb 6, 2012 at 16:10, Junio C Hamano <gitster@pobox.com> wrote:

> Perhaps Git is correct and your HEAD is not a descendant of any tag whose
> name matches the pattern "lal-v*".

Thanks you're right, the tags I was trying to match are on a different
branch. Back to the drawing board for this script.

Cheers

Adam

```
