refs.h: clarify reflog iteration order
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Han-Wen Nienhuys committed
May 20, 2020 at 17:36 UTC
d1eb22da09e0ffebbd6c16ef1d0e952ec7b88b8d
1 file changed
+17
-1
refs.h
+17
-1
@@ -432,19 +432,35 @@ int delete_refs(const char *msg, struct string_list *refnames,
432
int refs_delete_reflog(struct ref_store *refs, const char *refname);
433
int delete_reflog(const char *refname);
434
435
-/* iterate over reflog entries */
435
+/*
436
+ * Callback to process a reflog entry found by the iteration functions (see
437
+ * below)
438
+ */
439
typedef int each_reflog_ent_fn(
440
struct object_id *old_oid, struct object_id *new_oid,
441
const char *committer, timestamp_t timestamp,
442
int tz, const char *msg, void *cb_data);
443
444
+/* Iterate over reflog entries in the log for `refname`. */
445
+
446
+/* oldest entry first */
447
int refs_for_each_reflog_ent(struct ref_store *refs, const char *refname,
448
each_reflog_ent_fn fn, void *cb_data);
449
+
450
+/* youngest entry first */
451
int refs_for_each_reflog_ent_reverse(struct ref_store *refs,
452
const char *refname,
453
each_reflog_ent_fn fn,
454
void *cb_data);
455
+
456
+/*
457
+ * Iterate over reflog entries in the log for `refname` in the main ref store.
458
+ */
459
+
460
+/* oldest entry first */
461
int for_each_reflog_ent(const char *refname, each_reflog_ent_fn fn, void *cb_data);
462
+
463
+/* youngest entry first */
464
int for_each_reflog_ent_reverse(const char *refname, each_reflog_ent_fn fn, void *cb_data);
465
466
/*