diff mbox series

[v13,03/13] refs: document how ref_iterator_advance_fn should handle symrefs

Message ID be083a85fb54d6399641ca634c432952aa95e1ba.1589226388.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series Reftable support git-core | expand

Commit Message

Johannes Schindelin via GitGitGadget May 11, 2020, 7:46 p.m. UTC
From: Han-Wen Nienhuys <hanwen@google.com>

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
---
 refs/refs-internal.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Junio C Hamano May 18, 2020, 11:43 p.m. UTC | #1
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Han-Wen Nienhuys <hanwen@google.com>
>
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>  refs/refs-internal.h | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index ff2436c0fb7..3490aac3a40 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -438,6 +438,11 @@ void base_ref_iterator_free(struct ref_iterator *iter);
>  
>  /* Virtual function declarations for ref_iterators: */
>  
> +/*
> + * backend-specific implementation of ref_iterator_advance.
> + * For symrefs, the function should set REF_ISSYMREF, and it should also
> + * dereference the symref to provide the OID referent.
> + */
>  typedef int ref_iterator_advance_fn(struct ref_iterator *ref_iterator);

Shouldn't we also talk about the need for the backend to yield
broken refs with ISBROKEN (iow, you are not allowed to skip---let
the caller make the decision to skip) etc.?

Other than that, this is a good additional piece of information to
tell the implementors of new backend.

Thanks.





>  
>  typedef int ref_iterator_peel_fn(struct ref_iterator *ref_iterator,
diff mbox series

Patch

diff --git a/refs/refs-internal.h b/refs/refs-internal.h
index ff2436c0fb7..3490aac3a40 100644
--- a/refs/refs-internal.h
+++ b/refs/refs-internal.h
@@ -438,6 +438,11 @@  void base_ref_iterator_free(struct ref_iterator *iter);
 
 /* Virtual function declarations for ref_iterators: */
 
+/*
+ * backend-specific implementation of ref_iterator_advance.
+ * For symrefs, the function should set REF_ISSYMREF, and it should also
+ * dereference the symref to provide the OID referent.
+ */
 typedef int ref_iterator_advance_fn(struct ref_iterator *ref_iterator);
 
 typedef int ref_iterator_peel_fn(struct ref_iterator *ref_iterator,