Scan for new packs if GIT_DIR/objects/pack has been modified
If GIT_DIR/objects/pack directory has changed then one or more packs
may have been added to the directory, or removed from it, due to a
concurrent application performing a repack. In such cases we need
to reload the list of available packs before conducting a search.
As packs are infrequently created or modified relative to searches,
we only scan for new packs if our search through existing packs has
turned up no results.
Transports that create packs locally through IndexPack automatically
register their new PackFile, so even those cases will typically not
require scanning the object directory again.
As misses are fairly common during IndexPack (due to its automatic
collision detection logic) we avoid scanning for packs unless the
GIT_DIR/objects/pack directory has been modified since the last
scan of it.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>