[infer] Fix resource leak in IndexDiff
We only need the tree id to add it to a TreeWalk so change tree's type to AnyObjectId. Bug: 509385 Change-Id: I98dd5fef15cd173fe1fd84273f0f48e64e12e608 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
325cb35ccd
commit
1fb2319c18
|
@ -65,7 +65,6 @@
|
|||
import org.eclipse.jgit.errors.MissingObjectException;
|
||||
import org.eclipse.jgit.errors.StopWalkException;
|
||||
import org.eclipse.jgit.internal.JGitText;
|
||||
import org.eclipse.jgit.revwalk.RevTree;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.submodule.SubmoduleWalk;
|
||||
import org.eclipse.jgit.submodule.SubmoduleWalk.IgnoreSubmoduleMode;
|
||||
|
@ -248,7 +247,7 @@ public TreeFilter clone() {
|
|||
|
||||
private final Repository repository;
|
||||
|
||||
private final RevTree tree;
|
||||
private final AnyObjectId tree;
|
||||
|
||||
private TreeFilter filter = null;
|
||||
|
||||
|
@ -311,10 +310,13 @@ public IndexDiff(Repository repository, String revstr,
|
|||
public IndexDiff(Repository repository, ObjectId objectId,
|
||||
WorkingTreeIterator workingTreeIterator) throws IOException {
|
||||
this.repository = repository;
|
||||
if (objectId != null)
|
||||
tree = new RevWalk(repository).parseTree(objectId);
|
||||
else
|
||||
if (objectId != null) {
|
||||
try (RevWalk rw = new RevWalk(repository)) {
|
||||
tree = rw.parseTree(objectId);
|
||||
}
|
||||
} else {
|
||||
tree = null;
|
||||
}
|
||||
this.initialWorkingTreeIterator = workingTreeIterator;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue