Skip to content

Commit 7aaf909

Browse files
committed
DfsMidxWriter: Do not accept midx as input to build midx
We can use a midx to build a new midx, but it breaks the bitmaps. When we calculate the "midx offsets" to order objects in the bitmap, we assume each pack is a single pack (one packId). Throw an exception if the input for the midx is another midx, until we calculate properly the midx offsets. Link: https://review.gerrithub.io/id/I325443dc3281003b29b4d8a1598b83316a6a6964
1 parent 02dc228 commit 7aaf909

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsMidxWriter.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,13 @@ public static DfsPackDescription writeMidx(ProgressMonitor pm,
7777
PackIndexMerger.Builder dataBuilder = PackIndexMerger.builder();
7878
try (DfsReader ctx = objdb.newReader()) {
7979
for (DfsPackFile pack : packs) {
80+
if (pack instanceof DfsPackFileMidx) {
81+
// asObjectsToPack assumes one packid per pack while
82+
// calculating midx offsets. We need to fix that before
83+
// accepting midx to build new midx.
84+
throw new IOException(
85+
"MIDX not supported to build new midx"); //$NON-NLS-1$
86+
}
8087
dataBuilder.addPack(pack.getPackDescription().getPackName(),
8188
pack.getPackIndex(ctx));
8289
}

0 commit comments

Comments
 (0)