diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java index 3873c3728..2c4af7068 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/BitmapIndexImpl.java @@ -93,17 +93,6 @@ public class BitmapIndexImpl implements BitmapIndex { return new CompressedBitmap(compressed, this); } - public CompressedBitmap toBitmap(PackBitmapIndex i, - EWAHCompressedBitmap b) { - if (i != packIndex) { - throw new IllegalArgumentException(); - } - if (b == null) { - return null; - } - return new CompressedBitmap(b, this); - } - @Override public CompressedBitmapBuilder newBitmapBuilder() { return new CompressedBitmapBuilder(this); @@ -327,11 +316,18 @@ public class BitmapIndexImpl implements BitmapIndex { } } - static final class CompressedBitmap implements Bitmap { + /** + * Wrapper for a {@link EWAHCompressedBitmap} and {@link PackBitmapIndex}. + *
+ * For a EWAHCompressedBitmap {@code bitmap} representing a vector of + * bits, {@code new CompressedBitmap(bitmap, bitmapIndex)} represents the + * objects at those positions in {@code bitmapIndex.packIndex}. + */ + public static final class CompressedBitmap implements Bitmap { final EWAHCompressedBitmap bitmap; final BitmapIndexImpl bitmapIndex; - CompressedBitmap(EWAHCompressedBitmap bitmap, BitmapIndexImpl bitmapIndex) { + public CompressedBitmap(EWAHCompressedBitmap bitmap, BitmapIndexImpl bitmapIndex) { this.bitmap = bitmap; this.bitmapIndex = bitmapIndex; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java index 63da51879..77311abaa 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriterBitmapPreparer.java @@ -60,6 +60,7 @@ import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; import org.eclipse.jgit.internal.JGitText; import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl; +import org.eclipse.jgit.internal.storage.file.BitmapIndexImpl.CompressedBitmap; import org.eclipse.jgit.internal.storage.file.PackBitmapIndex; import org.eclipse.jgit.internal.storage.file.PackBitmapIndexBuilder; import org.eclipse.jgit.internal.storage.file.PackBitmapIndexRemapper; @@ -390,7 +391,7 @@ class PackWriterBitmapPreparer { if (!reuse.contains(rc)) { EWAHCompressedBitmap bitmap = bitmapRemapper.ofObjectType( bitmapRemapper.getBitmap(rc), Constants.OBJ_COMMIT); - reuse.or(commitBitmapIndex.toBitmap(writeBitmaps, bitmap)); + reuse.or(new CompressedBitmap(bitmap, commitBitmapIndex)); } }