From: Jeff King Date: Fri, 26 Dec 2025 04:45:07 GMT Subject: Re: Slow git pack-refs --all Message-ID: <20251226044507.GA1971832@coredump.intra.peff.net> In-Reply-To: On Thu, Dec 25, 2025 at 11:38:30PM +0000, brian m. carlson wrote: > I think this is from `should_pack_ref`: > > /* Do not pack broken refs: */ > if (!ref_resolves_to_object(ref->name, refs->base.repo, ref->oid, ref->flags)) > return 0; > > So Git is going to need to verify that the object at least exists. I > don't know why we would need to _open_ them, however. Perhaps someone > else has ideas. The packed-refs file stores tag-peeling information. So pack-refs opens the object for any newly written ref via peel_object(), which has to at least read the header to get the type. That call happens via write_with_updates() in packed-backend.c. If we wanted to be really pedantic, anything in refs/heads/ should not point to a non-commit and thus should never need to be peeled. I'm not sure if we want to embed that assumption in this code path, though (nor would it necessarily help Martin's case if the refs are not in refs/heads anyway). -Peff