Ensure that RevWalk in SubmoduleOp is released

Change-Id: I26fd8e7b1736a2f757e533a9db95590d482cd992
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-10-18 12:33:47 +02:00
parent 4cef11a77d
commit 5ba1f4276f

View File

@@ -365,14 +365,17 @@ public class SubmoduleOp {
private static DirCache readTree(final Repository pdb, final Ref branch)
throws MissingObjectException, IncorrectObjectTypeException, IOException {
final RevWalk rw = new RevWalk(pdb);
final DirCache dc = DirCache.newInCore();
final DirCacheBuilder b = dc.builder();
b.addTree(new byte[0], // no prefix path
DirCacheEntry.STAGE_0, // standard stage
pdb.newObjectReader(), rw.parseTree(branch.getObjectId()));
b.finish();
return dc;
try {
final DirCache dc = DirCache.newInCore();
final DirCacheBuilder b = dc.builder();
b.addTree(new byte[0], // no prefix path
DirCacheEntry.STAGE_0, // standard stage
pdb.newObjectReader(), rw.parseTree(branch.getObjectId()));
b.finish();
return dc;
} finally {
rw.release();
}
}
private static void logAndThrowSubmoduleException(final String errorMsg,