Re: [PATCH v12 01/12] refs.h: clarify reflog iteration order
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 8, 2020, 18:54 UTC
- Message-ID
- <xmqqlfm2xnod.fsf@gitster.c.googlers.com>
- In-Reply-To
- <dfa5fd74f859b2186d0222f98417128c52903fe7.1588845586.git.gitgitgadget@gmail.com>
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 17 quoted lines
> From: Han-Wen Nienhuys <hanwen@google.com> > > Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> > --- > refs.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/refs.h b/refs.h > index a92d2c74c83..9421c5b8465 100644 > --- a/refs.h > +++ b/refs.h > @@ -432,18 +432,21 @@ int delete_refs(const char *msg, struct string_list *refnames, > int refs_delete_reflog(struct ref_store *refs, const char *refname); > int delete_reflog(const char *refname); > > -/* iterate over reflog entries */ > +/* Iterate over reflog entries. */
It is not wrong per-se, but it is more problematic that this description is very similar to the functions that take callback functions of this type than it begins with lowercase.
/* Callback to process a reflog entry found by the iterators (see below) */
perhaps?
Show 6 quoted lines
> typedef int each_reflog_ent_fn( > struct object_id *old_oid, struct object_id *new_oid, > const char *committer, timestamp_t timestamp, > int tz, const char *msg, void *cb_data); > > +/* Iterate in over reflog entries, oldest entry first. */
/* Iterate over reflog entries of refname in refs */
/* oldest entry first */
> int refs_for_each_reflog_ent(struct ref_store *refs, const char *refname, > each_reflog_ent_fn fn, void *cb_data);
/* youngest entry first */
Show 6 quoted lines
> int refs_for_each_reflog_ent_reverse(struct ref_store *refs, > const char *refname, > each_reflog_ent_fn fn, > void *cb_data); > + > +/* Call a function for each reflog entry, oldest entry first. */
Likewise.
> int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void *cb_data); > int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn, void *cb_data);