aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2013-03-06 12:48:25 -0800
committerShawn Pearce <spearce@spearce.org>2013-03-06 12:48:25 -0800
commit913cccd5c4597d908698fdcb79eaf228c3afefb9 (patch)
treeeddaef6bf7e4565c8c5a97db874b3a0aa20c45fb /org.eclipse.jgit
parent88c962484f695971f75a6e776c5cb8e1257fddac (diff)
downloadjgit-913cccd5c4597d908698fdcb79eaf228c3afefb9.tar.gz
jgit-913cccd5c4597d908698fdcb79eaf228c3afefb9.zip
Do not attempt to read bitmap from invalid pack
If a pack file has been marked invalid due to a prior IOException accessing its contents, do not offer its bitmap index to callers. The pack cannot be used so its bitmap should be off limits from any reader trying to work from a bitmap. Change-Id: Ia44e46558abdddee560bb184158b1e0af9437eee
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java2
2 files changed, 4 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
index ed6628596a..80cced84e8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/DfsPackFile.java
@@ -277,6 +277,8 @@ public final class DfsPackFile {
}
PackBitmapIndex getBitmapIndex(DfsReader ctx) throws IOException {
+ if (invalid)
+ return null;
DfsBlockCache.Ref<PackBitmapIndex> idxref = bitmapIndex;
if (idxref != null) {
PackBitmapIndex idx = idxref.get();
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
index 31de381721..cd5de595c0 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/storage/file/PackFile.java
@@ -1057,6 +1057,8 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
}
synchronized PackBitmapIndex getBitmapIndex() throws IOException {
+ if (invalid)
+ return null;
if (bitmapIdx == null && hasExt(BITMAP_INDEX)) {
final PackBitmapIndex idx = PackBitmapIndex.open(
extFile(BITMAP_INDEX), idx(), getReverseIdx());