From: Patrick Steinhardt Date: Tue, 8 Apr 2025 06:22:12 +0000 (+0200) Subject: reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options` X-Git-Tag: v2.50.0-rc0~106^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2ed800839904d598b6c67e6ed2d57276bef9777d;p=thirdparty%2Fgit.git reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options` We're about to expose `struct cmd_reflog_expire_cb` via "reflog.h" so that we can also use this structure in "builtin/gc.c". Once we make it accessible to a wider scope though it becomes awkwardly named, as it isn't only useful in the context of a callback. Instead, the function is containing all kinds of options relevant to whether or not a reflog entry should be expired. Rename the structure to `reflog_expire_options` to prepare for this. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- diff --git a/builtin/reflog.c b/builtin/reflog.c index 95f264989b..dee49881d3 100644 --- a/builtin/reflog.c +++ b/builtin/reflog.c @@ -168,7 +168,7 @@ static int reflog_expire_config(const char *var, const char *value, return 0; } -static void set_reflog_expiry_param(struct cmd_reflog_expire_cb *cb, const char *ref) +static void set_reflog_expiry_param(struct reflog_expire_options *cb, const char *ref) { struct reflog_expire_cfg *ent; @@ -207,15 +207,15 @@ static int expire_unreachable_callback(const struct option *opt, const char *arg, int unset) { - struct cmd_reflog_expire_cb *cmd = opt->value; + struct reflog_expire_options *opts = opt->value; BUG_ON_OPT_NEG(unset); - if (parse_expiry_date(arg, &cmd->expire_unreachable)) + if (parse_expiry_date(arg, &opts->expire_unreachable)) die(_("invalid timestamp '%s' given to '--%s'"), arg, opt->long_name); - cmd->explicit_expiry |= EXPIRE_UNREACH; + opts->explicit_expiry |= EXPIRE_UNREACH; return 0; } @@ -223,15 +223,15 @@ static int expire_total_callback(const struct option *opt, const char *arg, int unset) { - struct cmd_reflog_expire_cb *cmd = opt->value; + struct reflog_expire_options *opts = opt->value; BUG_ON_OPT_NEG(unset); - if (parse_expiry_date(arg, &cmd->expire_total)) + if (parse_expiry_date(arg, &opts->expire_total)) die(_("invalid timestamp '%s' given to '--%s'"), arg, opt->long_name); - cmd->explicit_expiry |= EXPIRE_TOTAL; + opts->explicit_expiry |= EXPIRE_TOTAL; return 0; } @@ -276,7 +276,7 @@ static int cmd_reflog_list(int argc, const char **argv, const char *prefix, static int cmd_reflog_expire(int argc, const char **argv, const char *prefix, struct repository *repo UNUSED) { - struct cmd_reflog_expire_cb cmd = { 0 }; + struct reflog_expire_options opts = { 0 }; timestamp_t now = time(NULL); int i, status, do_all, single_worktree = 0; unsigned int flags = 0; @@ -292,15 +292,15 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix, N_("update the reference to the value of the top reflog entry"), EXPIRE_REFLOGS_UPDATE_REF), OPT_BOOL(0, "verbose", &verbose, N_("print extra information on screen")), - OPT_CALLBACK_F(0, "expire", &cmd, N_("timestamp"), + OPT_CALLBACK_F(0, "expire", &opts, N_("timestamp"), N_("prune entries older than the specified time"), PARSE_OPT_NONEG, expire_total_callback), - OPT_CALLBACK_F(0, "expire-unreachable", &cmd, N_("timestamp"), + OPT_CALLBACK_F(0, "expire-unreachable", &opts, N_("timestamp"), N_("prune entries older than