From: Patrick Steinhardt <ps@pks.im>
To: Justin Tobler <jltobler@gmail.com>
Cc: git@vger.kernel.org, Markus Gerstel <2025@uxp.de>,
Junio C Hamano <gitster@pobox.com>,
Derrick Stolee <stolee@gmail.com>
Subject: Re: [PATCH 3/6] builtin/reflog: stop storing per-reflog expiry dates globally
Date: Thu, 6 Mar 2025 11:37:41 +0100 [thread overview]
Message-ID: <Z8l69bRy8PY3Ep9J@pks.im> (raw)
In-Reply-To: <usf4pzrp322xvfrvsasgy22rnw7d2a6krzuctwpp23ppdgh6ji@ram73wv5dn54>
On Tue, Mar 04, 2025 at 05:41:08PM -0600, Justin Tobler wrote:
> On 25/02/26 04:24PM, Patrick Steinhardt wrote:
> > diff --git a/reflog.h b/reflog.h
> > index a9d464bbf8c..b08780a30a7 100644
> > --- a/reflog.h
> > +++ b/reflog.h
> > @@ -2,7 +2,15 @@
> > #define REFLOG_H
> > #include "refs.h"
> >
> > +struct reflog_expire_entry_option {
> > + struct reflog_expire_entry_option *next;
> > + timestamp_t expire_total;
> > + timestamp_t expire_unreachable;
> > + char pattern[FLEX_ARRAY];
> > +};
> > +
> > struct reflog_expire_options {
> > + struct reflog_expire_entry_option *entries, **entries_tail;
>
> Now we can also store the configured per-reflog-pattern expiry entries
> in the options type instead of relying on global state.
>
> > int stalefix;
> > int explicit_expiry;
> > timestamp_t default_expire_total;
>
> Now that all the reflog expiry configuration is contained within
> reflog_expire_options, I wonder if it really makes sense to also keep
> the expire_total and expire_unreachable fields.
>
> From my understanding these fields are not really for configuration, but
> hold the reflog expiry configuration for the current active reference
> while iterating. This gets set by set_reflog_expiry_param() prior to
> calling refs_reflog_expire(). It seems like this could be figured out
> during refs_reflog_expire() now.
Yes, these fields hold state indeed, namely the value for a given
refname. These fields thus need to be updated for every refname for
which you want to check expiration, which is done by calling
`reflog_expire_options_set_refname()`. This interfaces is extremely
awkward from my perspective, and it would be very much preferable to
instead have an interface that, given the options and a refname as
parameters, tells you whether the reflog contains entries that should be
pruned.
In fact, I did have a look at fixing this awkward interface, but it
always ended up with way more changes than I felt comfortable with. So I
decided to only go a couple steps into the direction of better
encapsulation, but to not fix all of the design issues with the current
interface.
Patrick
next prev parent reply other threads:[~2025-03-06 10:37 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-26 15:24 [PATCH 0/6] builtin/maintenance: introduce "reflog-expire" task Patrick Steinhardt
2025-02-26 15:24 ` [PATCH 1/6] reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options` Patrick Steinhardt
2025-02-26 15:24 ` [PATCH 2/6] builtin/reflog: stop storing default reflog expiry dates globally Patrick Steinhardt
2025-03-04 23:23 ` Justin Tobler
2025-02-26 15:24 ` [PATCH 3/6] builtin/reflog: stop storing per-reflog " Patrick Steinhardt
2025-03-04 23:41 ` Justin Tobler
2025-03-06 10:37 ` Patrick Steinhardt [this message]
2025-03-06 23:17 ` Justin Tobler
2025-02-26 15:24 ` [PATCH 4/6] builtin/reflog: make functions regarding `reflog_expire_options` public Patrick Steinhardt
2025-02-26 15:24 ` [PATCH 5/6] builtin/gc: split out function to expire reflog entries Patrick Steinhardt
2025-02-26 15:24 ` [PATCH 6/6] builtin/maintenance: introduce "reflog-expire" task Patrick Steinhardt
2025-02-26 17:50 ` [PATCH 0/6] " Ramsay Jones
2025-02-26 18:40 ` Junio C Hamano
2025-02-26 18:54 ` Ramsay Jones
2025-02-27 9:10 ` Patrick Steinhardt
2025-02-27 1:23 ` Junio C Hamano
2025-02-27 9:22 ` Patrick Steinhardt
2025-02-27 17:01 ` Junio C Hamano
2025-02-28 8:35 ` Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 " Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 1/6] reflog: rename `cmd_reflog_expire_cb` to `reflog_expire_options` Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 2/6] builtin/reflog: stop storing default reflog expiry dates globally Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 3/6] builtin/reflog: stop storing per-reflog " Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 4/6] builtin/reflog: make functions regarding `reflog_expire_options` public Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 5/6] builtin/gc: split out function to expire reflog entries Patrick Steinhardt
2025-04-08 6:22 ` [PATCH v2 6/6] builtin/maintenance: introduce "reflog-expire" task Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8l69bRy8PY3Ep9J@pks.im \
--to=ps@pks.im \
--cc=2025@uxp.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jltobler@gmail.com \
--cc=stolee@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).