On Wed, Feb 26, 2020 at 8:59 PM Junio C Hamano <gitster@xxxxxxxxx> wrote: > >> Without --show-head, HEAD should not appear in "git show-ref" > >> output, but the expected output has HEAD, which is puzzling. > > > > The HEAD symref is stored in reftable too, and to the reftable code > > it's just another ref. How should we refactor this? Shouldn't the > > files ref backend produce "HEAD" and then it's up to the show-ref > > builtin to filter it out? > > After looking at show-ref.c, the answer is obvious, I would think. > for_each_ref() MUST NOT include HEAD in its enumeration, and that is > why the caller of for_each_ref() makes a separate call to head_ref() > when it wants to talk about HEAD. As a backend-agnostic abstraction > layer, behaviour of functions like for_each_ref() should not change > depending on what ref backend is in use. So, the ref backend should manage the HEAD ref, but iteration should not produce the HEAD ref. Are there other refs that behave like this, or is this the only special case? -- Han-Wen Nienhuys - Google Munich I work 80%. Don't expect answers from me on Fridays. -- Google Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Paul Manicle, Halimah DeLaine Prado