From f91afe5f5764dbe93bdb085f489e056bac6d153c Mon Sep 17 00:00:00 2001 From: Ivan Frade Date: Fri, 13 Oct 2023 14:06:37 -0700 Subject: [PATCH] DfsPackFile: Do not attempt to read stream if pack doesn't have it Other getters (e.g. bitmap or commit graph) cover the case that the pack doesn't have the corresponding extension. Do the same here to detect this early and avoid an IOException in openFile. Change-Id: I29726b7ede0f795d35543453a3e7f92cee872a78 --- .../src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java index 8a2f4d354..e0f0e1355 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java @@ -310,7 +310,8 @@ private PackObjectSizeIndex getObjectSizeIndex(DfsReader ctx) return objectSizeIndex; } - if (objectSizeIndexLoadAttempted) { + if (objectSizeIndexLoadAttempted + || !desc.hasFileExt(OBJECT_SIZE_INDEX)) { // Pack doesn't have object size index return null; }