On 01/08/2025 18:14, Junio C Hamano wrote:
Phillip Wood <phillip.wood123@xxxxxxxxx> writes:
It is confusing that refs/heads does a prefix match but refs/heads/m
does not (unless there is a hierarchy boundary after the m).
And refs/hea would not show branches, for the same reason. It is
what "anchored at hierarchy boundary" in the message you are
responding to means. In other words, it is not a simple textual
prefix match.
The last sentence sums up why I find it confusing - it is not possible
to tell from the pattern what sort of match will be returned. If a
script wants to query some property of a ref it either has to know it
exists (which is racy but probably not a practical problem most of the
time) or it has to include %(refname) in the format argument and check
that it matches the ref in the query string. A script can force a prefix
match by adding a trailing slash but there is no way to force an exact
match.
Thanks
Phillip