import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX;
import static org.eclipse.jgit.internal.storage.pack.PackExt.KEEP;
+import static org.eclipse.jgit.internal.storage.pack.PackExt.REVERSE_INDEX;
import java.io.EOFException;
import java.io.File;
}
private synchronized PackReverseIndex getReverseIdx() throws IOException {
- if (reverseIdx == null)
- reverseIdx = PackReverseIndexFactory.computeFromIndex(idx());
+ if (invalid) {
+ throw new PackInvalidException(packFile, invalidatingCause);
+ }
+ if (reverseIdx == null) {
+ PackFile reverseIndexFile = packFile.create(REVERSE_INDEX);
+ reverseIdx = PackReverseIndexFactory.openOrCompute(reverseIndexFile,
+ getObjectCount(), () -> getIndex());
+ reverseIdx.verifyPackChecksum(getPackFile().getPath());
+ }
return reverseIdx;
}