Browse Source

PullCommandTest: Open RevWalk in try-with-resource

Change-Id: I676cd7ef4bb29f980a313acd77506dd070e6c98f
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
7ccda5f63e
  1. 33
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java

33
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/PullCommandTest.java

@ -140,11 +140,12 @@ public class PullCommandTest extends RepositoryTestCase {
ObjectId[] mergedCommits = mergeResult.getMergedCommits();
assertEquals(targetCommit.getId(), mergedCommits[0]);
assertEquals(sourceCommit.getId(), mergedCommits[1]);
RevCommit mergeCommit = new RevWalk(dbTarget).parseCommit(mergeResult
.getNewHead());
String message = "Merge branch 'master' of "
+ db.getWorkTree().getAbsolutePath();
assertEquals(message, mergeCommit.getShortMessage());
try (RevWalk rw = new RevWalk(dbTarget)) {
RevCommit mergeCommit = rw.parseCommit(mergeResult.getNewHead());
String message = "Merge branch 'master' of "
+ db.getWorkTree().getAbsolutePath();
assertEquals(message, mergeCommit.getShortMessage());
}
}
@Test
@ -259,11 +260,12 @@ public class PullCommandTest extends RepositoryTestCase {
ObjectId[] mergedCommits = mergeResult.getMergedCommits();
assertEquals(targetCommit.getId(), mergedCommits[0]);
assertEquals(sourceCommit.getId(), mergedCommits[1]);
RevCommit mergeCommit = new RevWalk(dbTarget).parseCommit(mergeResult
.getNewHead());
String message = "Merge branch 'other' of "
+ db.getWorkTree().getAbsolutePath();
assertEquals(message, mergeCommit.getShortMessage());
try (RevWalk rw = new RevWalk(dbTarget)) {
RevCommit mergeCommit = rw.parseCommit(mergeResult.getNewHead());
String message = "Merge branch 'other' of "
+ db.getWorkTree().getAbsolutePath();
assertEquals(message, mergeCommit.getShortMessage());
}
}
@Test
@ -293,11 +295,12 @@ public class PullCommandTest extends RepositoryTestCase {
ObjectId[] mergedCommits = mergeResult.getMergedCommits();
assertEquals(targetCommit.getId(), mergedCommits[0]);
assertEquals(sourceCommit.getId(), mergedCommits[1]);
RevCommit mergeCommit = new RevWalk(dbTarget).parseCommit(mergeResult
.getNewHead());
String message = "Merge branch 'other' of "
+ db.getWorkTree().getAbsolutePath() + " into other";
assertEquals(message, mergeCommit.getShortMessage());
try (RevWalk rw = new RevWalk(dbTarget)) {
RevCommit mergeCommit = rw.parseCommit(mergeResult.getNewHead());
String message = "Merge branch 'other' of "
+ db.getWorkTree().getAbsolutePath() + " into other";
assertEquals(message, mergeCommit.getShortMessage());
}
}
private enum TestPullMode {

Loading…
Cancel
Save