Re: [PATCH 1/3] refs: allow "HEAD" as decoration filter
- From
Derrick Stolee <derrickstolee@github.com>
- Date
- Jul 29, 2022, 13:23 UTC
- Message-ID
- <2bd24a6d-24a0-3910-3418-34e111a11a21@github.com>
- In-Reply-To
- <220726.86lesfnc0y.gmgdl@evledraar.gmail.com>
On 7/26/2022 11:10 AM, Ævar Arnfjörð Bjarmason wrote:
Show 17 quoted lines
>
> On Tue, Jul 26 2022, Derrick Stolee via GitGitGadget wrote:
>> if (prefix) {
>> strbuf_addstr(&normalized_pattern, prefix);
>> - }
>> - else if (!starts_with(pattern, "refs/"))
>> + } else if (!starts_with(pattern, "refs/") &&
>> + strcmp(pattern, "HEAD"))
>> strbuf_addstr(&normalized_pattern, "refs/");
>
> Arguably a digression for this series, but I think it would be very nice
> to have a pre-step where we'd create some pre-step to centrally declare
> these magical refs in some struct whose flags would cover these various
> cases.
>
> E.g. we have this hardcoded in should_autocreate_reflog(), in log-tree.c
> (which AFAICT is the reference to "HEAD" here), refs.c etc. etc.It's a good idea to collect our known ref namespaces into a single place so we can update them together when a new feature is added. This could help avoid the inconsistencies that already exist (such as not filtering "HEAD" or not coloring "refs/notes/").
Thanks, -Stolee