Subject: Re: Surprising 'git-describe --all --match' behavior.

From: Sergei Organov <[email-masked]>
Date: Thu, 19 Jun 2014 22:58:00 +0400

Junio C Hamano <[email-masked]> writes:

> Sergei Organov <[email-masked]> writes:
>
>> Just playing with it, got some surprises:
>>
>> $ git --version
>> git version 1.9.3
>>
>> $ git describe --all
>> heads/v3.5
>> $ git describe --all --match 'v*'
>> tags/v3.5.6b2-4-gab4bf78
>> $ git describe --all --match 'heads/v*'
>> fatal: No names found, cannot describe anything.
>
> I think
>
> $ git describe --help
>
>        ...
>        --match <pattern>
>            Only consider tags matching the given glob(7) pattern,
>            excluding the "refs/tags/" prefix. This can be used to
>            avoid leaking private tags from the repository.
>        ...
>
> is poorly phrased, especially its "excluding" part.  What it wants
> to say is "You give <pattern> but without refs/tags/, because the
> program helpfully always prepend refs/tags/ to your pattern and
> limit the output to those that match".  Hence you gave 'v*' as
> <pattern> and limited the output to those that match 'refs/tags/v*'
> (or you gave 'heads/v*' and limited to 'refs/tags/heads/v*').

OK, thanks, at least I now see how it works. So no <pattern> can ever
match any reference but tag, even when --all switch is given? If so,
appearance of --match effectively turns --all into --tags, that is still
rather confusing, isn't it?

Will something break if it won't helpfully prepend refs/tags/ once
--all is given?

-- 
Sergei.