On Mon, Dec 02, 2019 at 10:17:44PM -0800, Taylor Blau wrote: > > Good catch. The issue is that we only add entries to the hashmap in > > prepare_packed_git(), but they may be added to the pack list by other > > callers of install_packed_git(). It probably makes sense to just push > > the hashmap maintenance down into that function, like below. That > > requires an extra strhash() when inserting a new pack, but I don't think > > that's a big deal. > > Ah, great catch, and thanks for pointing it out. We have been running > this patch in production at GitHub for a few weeks now, but didn't > notice this because we never run tests with > 'GIT_TEST_MULTI_PACK_INDEX=1' in the environment. > > Perhaps in the future that might change, but I think that for now that > can explain why the failure wasn't noticed earlier. It would trigger in other contexts, too: anywhere we call install_packed_git() outside of prepare_packed_git(). I think the main reason we didn't notice in the tests or in production is that: - it would generally require re-scanning the pack directory, which implies an unexpected missing object (or a racy repack), which is not likely to happen during the tests - in most cases duplicates don't impact the outcome of the command at all. A duplicate entry in the packed_git list would just mean an extra pack to check for lookups. Most objects would be found in other packs (including its doppelganger entry), so the duplicate would float to the bottom of the MRU order. It's only lookups for objects we don't have that would pay a penalty (and it would be relatively small). But obviously it's still worth fixing. -Peff