diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java index a8d6dda06625fa2c05c7f18c099cc4bdb665f7f9..8f96ef5f067597ce2f2638fbac7affed2a634e79 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectDirectory.java @@ -416,10 +416,11 @@ private static Map<String, PackFile> reuseMap(final PackList old) { // This should never occur. It should be impossible for us // to have two pack files with the same name, as all of them // came out of the same directory. If it does, we promised to - // close any PackFiles we did not reuse, so close the one we - // just evicted out of the reuse map. + // close any PackFiles we did not reuse, so close the second, + // readers are likely to be actively using the first. // - prior.close(); + forReuse.put(prior.getPackFile().getName(), prior); + p.close(); } } return forReuse;