Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2018-02-06 05:37:25 -0500
committerThomas Wolf2018-02-06 05:37:25 -0500
commit33c9f8a25d25bda427e3567e962c02e50f08fc8c (patch)
treef45589f5caa08f210d27323dab2959871c8b7875 /org.eclipse.egit.gitflow
parentc42a9b71fa94b0fbf8f79461544966d28182e39d (diff)
downloadegit-33c9f8a25d25bda427e3567e962c02e50f08fc8c.tar.gz
egit-33c9f8a25d25bda427e3567e962c02e50f08fc8c.tar.xz
egit-33c9f8a25d25bda427e3567e962c02e50f08fc8c.zip
Close RevWalk in GitFlowOperation
Bug: 530757 Change-Id: I24b5401e3b413a771e6198c3874827b2c12a0f14 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.gitflow')
-rw-r--r--org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
index f14f465bc..78d8dd90c 100644
--- a/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
+++ b/org.eclipse.egit.gitflow/src/org/eclipse/egit/gitflow/op/GitFlowOperation.java
@@ -221,18 +221,19 @@ abstract public class GitFlowOperation implements IEGitOperation {
Ref develop = repository.findBranch(parentBranch);
Ref branch = repository.findBranch(branchName);
- RevWalk walk = new RevWalk(repository.getRepository());
+ try (RevWalk walk = new RevWalk(repository.getRepository())) {
+ RevCommit branchCommit = walk.parseCommit(branch.getObjectId());
+ RevCommit developCommit = walk.parseCommit(develop.getObjectId());
- RevCommit branchCommit = walk.parseCommit(branch.getObjectId());
- RevCommit developCommit = walk.parseCommit(develop.getObjectId());
+ RevCommit mergeBase = findCommonBase(walk, branchCommit,
+ developCommit);
- RevCommit mergeBase = findCommonBase(walk, branchCommit, developCommit);
+ walk.reset();
+ walk.setRevFilter(RevFilter.ALL);
+ int aheadCount = RevWalkUtils.count(walk, branchCommit, mergeBase);
- walk.reset();
- walk.setRevFilter(RevFilter.ALL);
- int aheadCount = RevWalkUtils.count(walk, branchCommit, mergeBase);
-
- return aheadCount;
+ return aheadCount;
+ }
}
private RevCommit findCommonBase(RevWalk walk, RevCommit branchCommit,

Back to the top