git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/4] builtin/maintenance: only consider `gc.reflogExpire` for "--auto"

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 19, 2026, 11:58 UTC
Message-ID
<av7kbFW33jKrm7xb@pks.im>
In-Reply-To
<87h5hejfw2.fsf@dev.null.iotcl.com.invalid>
On Wed, Nov 18, 2026 at 04:52:45PM +0100, Toon Claes wrote:
Show 31 quoted lines
> Patrick Steinhardt <ps@pks.im> 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
Previous: Toon ClaesNext: Patrick Steinhardt
Message 14 of 18 in “Improve performance of reflog expiration”
  1. 0/4 Improve performance of reflog expirationPatrick Steinhardt, Nov 18, 2026
  2. 1/4 refs/reftable: don't write new table on dry-run expirePatrick Steinhardt, Nov 18, 2026
  3. Karthik NayakNov 18, 2026
  4. Patrick SteinhardtNov 18, 2026
  5. Junio C HamanoNov 18, 2026
  6. Patrick SteinhardtNov 19, 2026
  7. 2/4 refs/reftable: don't write new table when expire is a no-opPatrick Steinhardt, Nov 18, 2026
  8. Karthik NayakNov 18, 2026
  9. Patrick SteinhardtNov 18, 2026
  10. Toon ClaesNov 18, 2026
  11. Patrick SteinhardtNov 19, 2026
  12. 3/4 builtin/maintenance: only consider `gc.reflogExpire` for "--auto"Patrick Steinhardt, Nov 18, 2026
  13. Toon ClaesNov 18, 2026
  14. Patrick SteinhardtNov 19, 2026
  15. 4/4 Documentation/config: fix typo in "maintenance.reflog-expire.auto"Patrick Steinhardt, Nov 18, 2026
  16. Toon ClaesNov 18, 2026
  17. Toon ClaesNov 18, 2026
  18. Patrick SteinhardtNov 19, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.