Merge "Ensure that RevWalk in SubmoduleOp is released"

This commit is contained in:
Shawn Pearce
2012-10-21 10:29:36 -07:00
committed by Gerrit Code Review

View File

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