Re: "There are too many unreachable loose objects" - why don't we run 'git prune' automatically?
- From
Jeff King <peff@peff.net>
- Date
- Jun 9, 2017, 05:27 UTC
- Message-ID
- <20170609052755.dsuqd4gizi2opoya@sigill.intra.peff.net>
- In-Reply-To
- <9C2F2EA2-0C59-4EA2-8C8E-10228FB82D90@gmail.com>
On Thu, Jun 08, 2017 at 02:45:48PM +0200, Lars Schneider wrote:
Show 10 quoted lines
> I recently ran into "There are too many unreachable loose objects; run > 'git prune' to remove them." after a "Auto packing the repository in > background for optimum performance." message. > > This was introduced with a087cc9 "git-gc --auto: protect ourselves from > accumulated cruft" but I don't understand the commit message really. > > Why don't we call 'git prune' automatically? I though Git would prune > unreachable objects after 90 days by default anyways. Is the warning > about unreachable objects that are not yet 90 days old?
We _do_ call "git prune", but we do so with whatever configured expiration time is (by default 2 weeks; the 90-day expiration is for reflogs).
The problem is that auto-gc kicked in because there were a bunch of loose objects, but after repacking and running "git prune" there were still enough loose objects to trigger auto-gc. Which means every command you run will do an auto-gc that never actually helps.
So you have two options:
1. Wait until those objects expire (which may be up to 2 weeks,
depending on how recent they are), at which point your auto-gc will
finally delete them. 2. Run "git prune". Without an argument it prunes everything now,
with no expiration period.I agree the existing message isn't great. There should probably be a big advise() block explaining what's going on (and that expert users can disable).
-Peff