Derrick Stolee [off-list ref] writes:
I wonder if we could do something more complicated in the long-term,
which was recommended to me by Jeff Hostetler: add the pack to the
packed_git list once we've indexed it. That way, we don't reprepare
and scan the packs one-by-one, but instead we insert to the list
a single pack that we already know about.
Yup, that was the first thing that came to my mind, i.e. the code
that installs a new packfile on disk in our repository must be ours,
so we should be able to tell that code to add the new packfile to
the in-core list without having to scan.
We may still need to scan when that strategy "fails" to protect
against racing with simultaneous repacking, though.