IndexPack: Tighten up new and base object bookkeeping
commit2bb8defa5447c15a4fcbf23aaace9f11995f3ad0
authorShawn O. Pearce <spearce@spearce.org>
Fri, 16 Apr 2010 15:52:43 +0000 (16 08:52 -0700)
committerShawn O. Pearce <spearce@spearce.org>
Sat, 17 Apr 2010 00:04:26 +0000 (16 17:04 -0700)
tree99d53d415f5ea42781b808524330667f3aa5329b
parent329a0e1689f2493b7034d15185f4fbf59c9e49bb
IndexPack: Tighten up new and base object bookkeeping

The only current consumer of these collections is ReceivePack,
where it needs to test ObjectId equality between a RevObject and an
ObjectId.  There we were copying from a traditional HashSet<ObjectId>
into an ObjectIdSubclassMap<ObjectId>, as the latter can perform
hashing using ObjectId's native value support, bypassing RevObject's
override on hashCode() and equals().  Instead of doing that copy,
directly create ObjectIdSubclassMap instances inside of ReceivePack.

We also only need to record the objects that do not appear in the
incoming pack, and were therefore copied from the local repositiory
in order to complete delta resolution.  Instead of listing everything
that used an OBJ_REF_DELTA format, list only the objects that we
pulled from the destination repository via a normal ObjectLoader.

ReceivePack can now discard the IndexPack object, and all of its
other data, as soon as these collections are held by the check
connectivity method.  This frees up memory for the ObjectWalk's
own RevObject pool.

Change-Id: I22ef71b45c2045a0202e7fd550a770ee1f6f38a6
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit/src/org/eclipse/jgit/transport/IndexPack.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/ReceivePack.java