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.