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

Re: 'git gc auto' didn't trigger on large reflog

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 26, 2025, 16:10 UTC
Message-ID
<xmqq4j0gg00h.fsf@gitster.g>
In-Reply-To
<Z779d7SnW5j8XcOb@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 9 quoted lines
> No, there isn't, and computing it is also potentially expensive. You
> basically have to iterate through each reflog and then also iterate
> through all of its reflog entries to figure out whether anything needs
> cleaning or not.
>
> But probably we can come up with clever heuristics instead that don't
> require us to be this thorough. We could for example just read the
> "HEAD" reflog and figure out whether it contains reflog entries that
> would be pruned.

As we should be able to "seek" to implement HEAD@{2.months.ago}, I'd imagine that we should be able to ask "give me the oldest entry in your log" to a ref. Ask that question to a handful of refs that have been most recently modified (with the theory that a ref that is more often modified is also likely to have been touched in the recent past---your HEAD heuristics is a good approximation), and we learn fairly cheaply if it is likely that we have entries to be expired.

Previous: Patrick Steinhardt
Message 5 of 5 in “'git gc auto' didn't trigger on large reflog”
  1. Markus GerstelFeb 22, 2025
  2. Patrick SteinhardtFeb 24, 2025
  3. Junio C HamanoFeb 24, 2025
  4. Patrick SteinhardtFeb 26, 2025
  5. Junio C HamanoFeb 26, 2025

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.