import org.eclipse.jgit.lib.BatchingProgressMonitor;
import org.eclipse.jgit.lib.BitmapIndex;
import org.eclipse.jgit.lib.BitmapIndex.BitmapBuilder;
+import org.eclipse.jgit.lib.BitmapIndex.BitmapLookupListener;
import org.eclipse.jgit.lib.BitmapObject;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.NullProgressMonitor;
if (!shallowPack && useBitmaps) {
BitmapIndex bitmapIndex = reader.getBitmapIndex();
if (bitmapIndex != null) {
- BitmapWalker bitmapWalker = new BitmapWalker(
- walker, bitmapIndex, countingMonitor);
+ bitmapIndex.addBitmapLookupListener(new BitmapLookupListener() {
+ @Override
+ public void onBitmapFound(AnyObjectId oid) {
+ stats.objectsWithBitmapsFound.add(oid);
+ }
+
+ @Override
+ public void onBitmapNotFound(AnyObjectId oid) {
+ // Nothing to do
+ }
+ });
+ BitmapWalker bitmapWalker = new BitmapWalker(walker,
+ bitmapIndex, countingMonitor);
findObjectsToPackUsingBitmaps(bitmapWalker, want, have);
endPhase(countingMonitor);
stats.timeCounting = System.currentTimeMillis() - countingStart;
import static org.eclipse.jgit.lib.Constants.OBJ_TREE;
import java.text.MessageFormat;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.internal.storage.pack.CachedPack;
+import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.lib.ObjectId;
/**
/** Commits with no parents. */
public Set<ObjectId> rootCommits;
+ /**
+ * Set of objects with bitmap hit when finding objects to pack.
+ *
+ * The size of this set plus {@link #bitmapIndexMisses} should be the
+ * walked size of the graph
+ *
+ * @since 6.9
+ */
+ public Set<AnyObjectId> objectsWithBitmapsFound = new HashSet<>();
+
/** If a shallow pack, the depth in commits. */
public int depth;
return statistics.clientShallowCommits;
}
+ /**
+ * Get unmodifiable collection of objects walked in the request that had a
+ * bitmap.
+ *
+ * @return ummodifiable collection of objects that had a bitmap attached
+ *
+ * @since 6.9
+ */
+ public Set<AnyObjectId> getObjectsWithBitmapsFound() {
+ return Collections.unmodifiableSet(statistics.objectsWithBitmapsFound);
+ }
+
/**
* Get unmodifiable list of the cached packs that were reused in the output
*