From: Patrick Steinhardt Date: Thu, 19 Nov 2026 11:58:36 GMT Subject: Re: [PATCH 3/4] builtin/maintenance: only consider `gc.reflogExpire` for "--auto" Message-ID: In-Reply-To: <87h5hejfw2.fsf@dev.null.iotcl.com.invalid> On Wed, Nov 18, 2026 at 04:52:45PM +0100, Toon Claes wrote: > Patrick Steinhardt writes: > > > The "reflog-expire" maintenance task is responsible for expiring reflog > > entries that are older than either "gc.reflogExpire" for entries that > > are still reachable, or "gc.reflogExpireUnreachable" for those that are > > not reachable. > > > > When executed with "--auto", the condition that we use to trigger this > > task verifies whether the number of reflog entries that we would prune > > is larger than "maintenance.reflog-expire.auto". This is evaluated by > > walking the "HEAD" reflog, where we then check every entry by calling > > `should_expire_reflog_ent()`. That function will then check whether the > > reflog entry refers to a commit that is reachable or not, and depending > > on the outcome compares against either "gc.reflogExpire", or against > > both "gc.reflogExpire" and "gc.reflogExpireUnreachable". > > > > To decide reachability the caller has to call `reflog_expiry_prepare()`, > > which amongst other things also performs a reachability walk for a given > > refname. But we don't do that in the "reflog-expire" maintenance task, > > and hence every single reflog entry will be considered unreachable and > > thus we'd consider many reachable entries prunable even though they > > won't be pruned. So we overcount the number of prunable entries quite a > > bit and will thus trigger `git reflog expire` even though it won't do > > anything. > > > > Now we could easiliy fix that by calling `reflog_expiry_prepare()`. > > Do you mean "not calling"? > > Anyhow, from reading the diff and the surrounding code, it's not clear > to me where this is/was called? It isn't called, and that's exactly the problem because we need to call it to compute reachability. So we could fix this by starting to call the function, but we instead pick a different route to fix this issue. Patrick