Browse Source

Ensure PackWriter releases its ObjectReader

Change-Id: I3f8af29066cc5a2132dc4a75c9654d97800f2f18
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.9
Shawn O. Pearce 15 years ago
parent
commit
b5aa52e98a
  1. 11
      org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

11
org.eclipse.jgit/src/org/eclipse/jgit/storage/pack/PackWriter.java

@ -610,19 +610,22 @@ public class PackWriter {
* stream. * stream.
*/ */
public void writePack(OutputStream packStream) throws IOException { public void writePack(OutputStream packStream) throws IOException {
try {
if ((reuseDeltas || reuseObjects) && reuseSupport != null) if ((reuseDeltas || reuseObjects) && reuseSupport != null)
searchForReuse(); searchForReuse();
out = new PackOutputStream(packStream, isDeltaBaseAsOffset()); out = new PackOutputStream(packStream, isDeltaBaseAsOffset());
writeMonitor.beginTask(WRITING_OBJECTS_PROGRESS, getObjectsNumber()); int cnt = getObjectsNumber();
out.writeFileHeader(PACK_VERSION_GENERATED, getObjectsNumber()); writeMonitor.beginTask(WRITING_OBJECTS_PROGRESS, cnt);
out.writeFileHeader(PACK_VERSION_GENERATED, cnt);
writeObjects(); writeObjects();
writeChecksum(); writeChecksum();
writeMonitor.endTask();
} finally {
out = null; out = null;
reader.release(); reader.release();
writeMonitor.endTask(); }
} }
private void searchForReuse() throws IOException { private void searchForReuse() throws IOException {

Loading…
Cancel
Save