Re: [PATCH v7 6/6] Reftable support for git-core

2 messages, 2 authors, 2020-02-27 · open the first message on its own page

Re: [PATCH v7 6/6] Reftable support for git-core

From: Junio C Hamano <hidden>
Date: 2020-02-27 16:23:13

Han-Wen Nienhuys [off-list ref] writes:
So, the ref backend should manage the HEAD ref, but iteration should
not produce the HEAD ref.
Yeah, as there is a dedicated API function head_ref().

Things like ORIG_HEAD and MERGE_HEAD have always been curiosity
outside the official API, but IIRC read_ref() and friends are
prepared to read them [*1*], so the vocabulary may be unbounded [*2*].

These won't be listed in for_each_ref() iteration, either (think of
for_each_ref() as a filtered "ls -R .git/refs/" output).

Thanks.


[Footnotes]

*1* I do not offhand know if these *_HEAD pseudo-refs are written
via the refs API---it probably is the safest to arrange the ref
backends in such a way that they always go to the files backend,
even if HEAD and refs/* are managed by a backend different from the
files one.

*2* I vaguely recall that back when ref-backend infrastructure was
introduced, we had discussion on declaring that "^[A-Z_]*HEAD$"
directly under $GIT_DIR/ are these special refs (and nothing else
directly under $GIT_DIR/ is).  I do not recall what happend to the
discussion, though other folks may.

Re: [PATCH v7 6/6] Reftable support for git-core

From: Han-Wen Nienhuys <hidden>
Date: 2020-02-27 17:57:07

On Thu, Feb 27, 2020 at 5:23 PM Junio C Hamano [off-list ref] wrote:
Han-Wen Nienhuys [off-list ref] writes:
quoted
So, the ref backend should manage the HEAD ref, but iteration should
not produce the HEAD ref.
Yeah, as there is a dedicated API function head_ref().

Things like ORIG_HEAD and MERGE_HEAD have always been curiosity
outside the official API, but IIRC read_ref() and friends are
prepared to read them [*1*], so the vocabulary may be unbounded [*2*].

These won't be listed in for_each_ref() iteration, either (think of
for_each_ref() as a filtered "ls -R .git/refs/" output).

currently the code says

 int refs_for_each_ref(struct ref_store *refs, each_ref_fn fn, void *cb_data)
 {
   return do_for_each_ref(refs, "", fn, 0, 0, cb_data);
 }

but it looks like this should do

   return do_for_each_ref(refs, "refs/", fn, 0, 0, cb_data);

instead.

-- 
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help