Re: [PATCH v3 4/4] for-each-ref: avoid filtering on empty pattern
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 9, 2024, 17:15 UTC
- Message-ID
- <xmqq8r3timnr.fsf@gitster.g>
- In-Reply-To
- <ZcXddvQzlt6j7T7L@tanuki>
Patrick Steinhardt <ps@pks.im> writes:
Show 17 quoted lines
> Depending on the answer, I think we can go one of two ways: > > - Accept the diverging behaviour and add `--include-all-refs`. The > "files" backend does a best effort and only includes root refs, the > "reftable" backend lists all refs. > > - Double down on the fact that refs must either be pseudo refs or > start with "refs/" and treat any ref that doesn't fit this bill as > corrupted. The consequence here would be that we instead go with > `--include-root-refs` that can be implemented the same for both > backends. In addition, we add checks to git-fsck(1) to surface and > flag refs with bogus names for the "reftable" backend. > > While I seem to have convinced you that `--include-all-refs` might not > be a bad idea after all, you have convinced me by now that the second > option would be preferable. I'd be okay with either of these options as > both of them address the issue at hand.
For now my tentative preference is the latter. If ref/head/foo is an end-user mistake with one backend, it is cleaner if it is considered a mistake with other backends.
Doesn't our ref enumeration/iteration API have "include broken ones as well" bit? I wonder if this issue becomes easier to solve by (re|ab)using that bit.