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 5786019e9..0f724af0d 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 @@ -92,6 +92,17 @@ public class BitmapIndexImpl implements BitmapIndex { return new CompressedBitmap(compressed); } + public CompressedBitmap toBitmap(PackBitmapIndex i, + EWAHCompressedBitmap b) { + if (i != packIndex) { + throw new IllegalArgumentException(); + } + if (b == null) { + return null; + } + return new CompressedBitmap(b); + } + public CompressedBitmapBuilder newBitmapBuilder() { return new CompressedBitmapBuilder(); } 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 e244de790..ed1da4f30 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 @@ -76,6 +76,8 @@ import org.eclipse.jgit.storage.pack.PackConfig; import org.eclipse.jgit.util.BlockList; import org.eclipse.jgit.util.SystemReader; +import com.googlecode.javaewah.EWAHCompressedBitmap; + /** * Helper class for the {@link PackWriter} to select commits for which to build * pack index bitmaps. @@ -347,11 +349,11 @@ class PackWriterBitmapPreparer { RevCommit rc = (RevCommit) ro; reuseCommits.add(new BitmapCommit(rc, false, entry.getFlags())); rw.markUninteresting(rc); - // PackBitmapIndexRemapper.ofObjectType() ties the underlying - // bitmap in the old pack into the new bitmap builder. - bitmapRemapper.ofObjectType(bitmapRemapper.getBitmap(rc), - Constants.OBJ_COMMIT).trim(); - reuse.add(rc, Constants.OBJ_COMMIT); + if (!reuse.contains(rc)) { + EWAHCompressedBitmap bitmap = bitmapRemapper.ofObjectType( + bitmapRemapper.getBitmap(rc), Constants.OBJ_COMMIT); + reuse.or(commitBitmapIndex.toBitmap(writeBitmaps, bitmap)); + } } // Add branch tips that are not represented in old bitmap indices. Set