Re: [GSoC][RFC PATCH v4 3/5] builtin/refs: add list subcommand
- From
- Phillip Wood <phillip.wood123@gmail.com>
- Date
- Aug 4, 2025, 09:28 UTC
- Message-ID
- <9544a669-3e3a-492f-a312-748b5d49bec3@gmail.com>
- In-Reply-To
- <xmqqwm7nklqf.fsf@gitster.g>
On 01/08/2025 18:14, Junio C Hamano wrote:
Show 9 quoted lines
> Phillip Wood <phillip.wood123@gmail.com> 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