From: Phillip Wood Date: Mon, 04 Aug 2025 09:28:05 GMT Subject: Re: [GSoC][RFC PATCH v4 3/5] builtin/refs: add list subcommand Message-ID: <9544a669-3e3a-492f-a312-748b5d49bec3@gmail.com> In-Reply-To: On 01/08/2025 18:14, Junio C Hamano wrote: > Phillip Wood 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