Browse Source

Close RevWalk in BranchTrackingStatus.of()

Bug: 530757
Change-Id: I985ee5395e1468981c28ae0a80797732e2f528d2
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.11
Matthias Sohn 7 years ago
parent
commit
f7244b81cc
  1. 9
      org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java

9
org.eclipse.jgit/src/org/eclipse/jgit/lib/BranchTrackingStatus.java

@ -87,7 +87,7 @@ public class BranchTrackingStatus {
if (local == null)
return null;
RevWalk walk = new RevWalk(repository);
try (RevWalk walk = new RevWalk(repository)) {
RevCommit localCommit = walk.parseCommit(local.getObjectId());
RevCommit trackingCommit = walk.parseCommit(tracking.getObjectId());
@ -100,9 +100,12 @@ public class BranchTrackingStatus {
walk.reset();
walk.setRevFilter(RevFilter.ALL);
int aheadCount = RevWalkUtils.count(walk, localCommit, mergeBase);
int behindCount = RevWalkUtils.count(walk, trackingCommit, mergeBase);
int behindCount = RevWalkUtils.count(walk, trackingCommit,
mergeBase);
return new BranchTrackingStatus(trackingBranch, aheadCount, behindCount);
return new BranchTrackingStatus(trackingBranch, aheadCount,
behindCount);
}
}
private final String remoteTrackingBranch;

Loading…
Cancel
Save