Re: [PATCH v4 1/5] refs: introduce `is_pseudoref()` and `is_headref()`
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 13, 2024, 19:42 UTC
- Message-ID
- <xmqqh6ic5ex3.fsf@gitster.g>
- In-Reply-To
- <ZcoTbRxIaGmTd4fJ@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
> I wonder whether we can maybe consolidate the interface into one or > maybe even two functions where the behaviour can be tweaked with a flag > field. Something like `refname_is_valid()` with a bunch of flags: > > - REFNAME_ACCEPT_HEAD to accept "HEAD" > - REFNAME_ACCEPT_PSEUDOREF to accept all of the refs ending with > "_HEAD" or being one of the irregular pseudorefs. > - REFNAME_ACCEPT_INVALID_BUT_SAFE to accept refnames which aren't > valid, but which would pass `refname_is_safe()`.
I am certain we _can_, but it will take an actual patch to see if such a refactoring makes the callers easier to follow, which is the real test. FWIW, I am much less skeptical than hopeful in this particular case.