diff options
author | Sam Delmerico <delmerico@google.com> | 2024-03-27 12:09:42 -0700 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2024-04-02 20:28:22 +0000 |
commit | e118d4382358e2258703b4f3d96d29254b8e5279 (patch) | |
tree | 8e6c157dbad72046c1b54c06b87cdcc4765384f6 /org.eclipse.jgit | |
parent | 82b224c0d109d4debe765f7c2ee5f220694eca58 (diff) | |
download | jgit-e118d4382358e2258703b4f3d96d29254b8e5279.tar.gz jgit-e118d4382358e2258703b4f3d96d29254b8e5279.zip |
PackBitmapIndexBuilder: allow repeated call of getCompressedBitmaps()
Each call of the current implementation of
PackBitmapIndexBuilder.getCompressedBitmaps reverses the class member that is returned. So two subsequent calls of this function will
receive reversed structures.
Instead we should just reverse a copy of the structure. This way the
PackBitmapIndexBuilder can continue to efficiently accept new bitmaps
via processBitmapForWrite (because we can continue to add to the back of
the bitmapsToWrite ArrayList) while ensuring that the bitmaps are
returned in the correct ordering from getCompressedBitmaps.
Change-Id: If7364222b9e62920c0c2c06894716fe85dd13315
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java index a47f2dfcc8..d73c7ce887 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackBitmapIndexBuilder.java @@ -323,8 +323,9 @@ public class PackBitmapIndexBuilder extends BasePackBitmapIndex { generateStoredEntry(bitmapsToWriteXorBuffer.pollFirst())); } - Collections.reverse(bitmapsToWrite); - return bitmapsToWrite; + List<StoredEntry> bitmapsToReturn = new ArrayList<>(bitmapsToWrite); + Collections.reverse(bitmapsToReturn); + return bitmapsToReturn; } /** Data object for the on disk representation of a bitmap entry. */ |