import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.ObjectIdOwnerMap;
import org.eclipse.jgit.lib.ProgressMonitor;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.revwalk.RevWalk;
out.close();
}
- final List<ObjectId> packedObjs = pw.getObjectList();
+ final ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> packedObjs = pw
+ .getObjectSet();
newPackObj.add(new PackWriter.ObjectIdSet() {
public boolean contains(AnyObjectId objectId) {
- return 0 <= Collections.binarySearch(packedObjs, objectId);
+ return packedObjs.contains(objectId);
}
});
}
/**
- * Returns the object ids in the pack file that was created by this writer,
- * sorted by name.
+ * Returns the object ids in the pack file that was created by this writer.
*
* This method can only be invoked after
* {@link #writePack(ProgressMonitor, ProgressMonitor, OutputStream)} has
* @throws IOException
* a cached pack cannot supply its object ids.
*/
- public List<ObjectId> getObjectList() throws IOException {
+ public ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> getObjectSet()
+ throws IOException {
if (!cachedPacks.isEmpty())
throw new IOException(
JGitText.get().cachedPacksPreventsListingObjects);
- return Collections.unmodifiableList(
- (List<? extends ObjectId>) sortByName());
+ ObjectIdOwnerMap<ObjectIdOwnerMap.Entry> objs = new ObjectIdOwnerMap<
+ ObjectIdOwnerMap.Entry>();
+ for (BlockList<ObjectToPack> objList : objectsLists) {
+ if (objList != null) {
+ for (ObjectToPack otp : objList)
+ objs.add(new ObjectIdOwnerMap.Entry(otp) {
+ // A new entry that copies the ObjectId
+ });
+ }
+ }
+ return objs;
}
/**