Scan for new packs if GIT_DIR/objects/pack has been modified
commitb17c8348a18a4718c7b3afc337abb01ef73557ef
authorShawn O. Pearce <spearce@spearce.org>
Tue, 21 Apr 2009 02:08:07 +0000 (20 19:08 -0700)
committerRobin Rosenberg <robin.rosenberg@dewire.com>
Thu, 23 Apr 2009 22:25:57 +0000 (24 00:25 +0200)
tree78600f2819d1429708eb876f6cd47f0f25d56858
parent1bf1c97220ef033e83869c4bdb63bea457e18d44
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>
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDatabase.java
org.spearce.jgit/src/org/spearce/jgit/lib/ObjectDirectory.java