On 22/05/2025 19:55, brian m. carlson wrote:
In a future commit, we'll use this function and the corresponding free
function to read the entire reflog. Expose it in the header so we can
do so.
We already have refs_for_each_reflog_entry() and
refs_for_each_reflog_entry_reverse() for traversing the reflog entries
so I'm a bit confused as to why we need to make the internal details public.
Thanks
Phillip
Include the appropriate header files so that our header is complete.
Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
---
reflog-walk.c | 17 ++---------------
reflog-walk.h | 18 ++++++++++++++++++
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/reflog-walk.c b/reflog-walk.c
index c7070b13b0..b7a9d70966 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -9,19 +9,6 @@
#include "string-list.h"
#include "reflog-walk.h"
-struct complete_reflogs {
- char *ref;
- char *short_ref;
- struct reflog_info {
- struct object_id ooid, noid;
- char *email;
- timestamp_t timestamp;
- int tz;
- char *message;
- } *items;
- int nr, alloc;
-};
-
static int read_one_reflog(struct object_id *ooid, struct object_id *noid,
const char *email, timestamp_t timestamp, int tz,
const char *message, void *cb_data)
@@ -41,7 +28,7 @@ static int read_one_reflog(struct object_id *ooid, struct object_id *noid,
return 0;
}
-static void free_complete_reflog(struct complete_reflogs *array)
+void free_complete_reflog(struct complete_reflogs *array)
{
int i;
@@ -64,7 +51,7 @@ static void complete_reflogs_clear(void *util, const char *str UNUSED)
free_complete_reflog(array);
}
-static struct complete_reflogs *read_complete_reflog(const char *ref)
+struct complete_reflogs *read_complete_reflog(const char *ref)
{
struct complete_reflogs *reflogs =
xcalloc(1, sizeof(struct complete_reflogs));
diff --git a/reflog-walk.h b/reflog-walk.h
index 989583dc55..8f0640f662 100644
--- a/reflog-walk.h
+++ b/reflog-walk.h
@@ -1,9 +1,24 @@
#ifndef REFLOG_WALK_H
#define REFLOG_WALK_H
+#include "git-compat-util.h"
+#include "hash.h"
+
struct commit;
struct reflog_walk_info;
struct date_mode;
+struct complete_reflogs {
+ char *ref;
+ char *short_ref;
+ struct reflog_info {
+ struct object_id ooid, noid;
+ char *email;
+ timestamp_t timestamp;
+ int tz;
+ char *message;
+ } *items;
+ int nr, alloc;
+};
void init_reflog_walk(struct reflog_walk_info **info);
void reflog_walk_info_release(struct reflog_walk_info *info);
@@ -24,4 +39,7 @@ int reflog_walk_empty(struct reflog_walk_info *walk);
struct commit *next_reflog_entry(struct reflog_walk_info *reflog_info);
+void free_complete_reflog(struct complete_reflogs *array);
+struct complete_reflogs *read_complete_reflog(const char *ref);
+
#endif