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

From: Junio C Hamano <[email-masked]>
Date: Mon, 24 Feb 2025 08:43:23 -0800

Patrick Steinhardt <[email-masked]> writes:

> It's a bit funny, but whether or not `git gc --auto` does anything
> solely depends on the state of the object database.

I guess after adding "auto", we haven't been careful enough to
update the triggering condition as we added new kinds of "garbage"
to collect?  Should we make an exhausitive and authoritative list of
gc tasks, document them, and make sure "--auto" pays attention?

Other than objects (packing loose ones, pruning unreferenced loose
ones or packing them into cruft packs), we seem to check reflog,
worktree, and rerere database.

I do not think there is a readily usable API to query how much stale
data is in reflogs that are more than N seconds old, without which
"gc --auto" cannot make decisions.  I am reasonably sure rerere API
does not give you such data, either.  I have no idea about the
triggering condition of "worktree prune".