builtin/reflog: make functions regarding reflog_expire_options public

Make functions that are required to manage `reflog_expire_options`
available elsewhere by moving them into "reflog.c" and exposing them in
the corresponding header. The functions will be used in a subsequent
commit.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2025-04-08 08:22:15 +02:00
committed by Junio C Hamano
parent 964f364de9
commit d20fc193b6
3 changed files with 128 additions and 111 deletions

View File

@@ -2,6 +2,9 @@
#define REFLOG_H
#include "refs.h"
#define REFLOG_EXPIRE_TOTAL (1 << 0)
#define REFLOG_EXPIRE_UNREACH (1 << 1)
struct reflog_expire_entry_option {
struct reflog_expire_entry_option *next;
timestamp_t expire_total;
@@ -24,6 +27,20 @@ struct reflog_expire_options {
.default_expire_unreachable = now - 90 * 24 * 3600, \
}
/*
* Parse the reflog expire configuration. This should be used with
* `repo_config()`.
*/
int reflog_expire_config(const char *var, const char *value,
const struct config_context *ctx, void *cb);
/*
* Adapt the options so that they apply to the given refname. This applies any
* per-reference reflog expiry configuration that may exist to the options.
*/
void reflog_expire_options_set_refname(struct reflog_expire_options *cb,
const char *refname);
struct expire_reflog_policy_cb {
enum {
UE_NORMAL,