Merge "Ensure that RevWalk in SubmoduleOp is released"
This commit is contained in:
@@ -365,14 +365,17 @@ public class SubmoduleOp {
|
|||||||
private static DirCache readTree(final Repository pdb, final Ref branch)
|
private static DirCache readTree(final Repository pdb, final Ref branch)
|
||||||
throws MissingObjectException, IncorrectObjectTypeException, IOException {
|
throws MissingObjectException, IncorrectObjectTypeException, IOException {
|
||||||
final RevWalk rw = new RevWalk(pdb);
|
final RevWalk rw = new RevWalk(pdb);
|
||||||
|
try {
|
||||||
final DirCache dc = DirCache.newInCore();
|
final DirCache dc = DirCache.newInCore();
|
||||||
final DirCacheBuilder b = dc.builder();
|
final DirCacheBuilder b = dc.builder();
|
||||||
b.addTree(new byte[0], // no prefix path
|
b.addTree(new byte[0], // no prefix path
|
||||||
DirCacheEntry.STAGE_0, // standard stage
|
DirCacheEntry.STAGE_0, // standard stage
|
||||||
pdb.newObjectReader(), rw.parseTree(branch.getObjectId()));
|
pdb.newObjectReader(), rw.parseTree(branch.getObjectId()));
|
||||||
b.finish();
|
b.finish();
|
||||||
return dc;
|
return dc;
|
||||||
|
} finally {
|
||||||
|
rw.release();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void logAndThrowSubmoduleException(final String errorMsg,
|
private static void logAndThrowSubmoduleException(final String errorMsg,
|
||||||
|
|||||||
Reference in New Issue
Block a user