Browse Source

BranchCommandTest: Create Git instances in try-with-resource

Also remove a local variable in one of the tests that was
hiding a member variable with the same name.

Change-Id: Ia4d94cdbf2d83d8be2645f0a93d8891d01606c59
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago committed by Matthias Sohn
parent
commit
78b3f174f2
  1. 6
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java

6
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/BranchCommandTest.java

@ -104,7 +104,7 @@ public class BranchCommandTest extends RepositoryTestCase {
private Git setUpRepoWithRemote() throws Exception {
Repository remoteRepository = createWorkRepository();
Git remoteGit = new Git(remoteRepository);
try (Git remoteGit = new Git(remoteRepository)) {
// commit something
writeTrashFile("Test.txt", "Hello world");
remoteGit.add().addFilepattern("Test.txt").call();
@ -136,6 +136,7 @@ public class BranchCommandTest extends RepositoryTestCase {
rup.update();
return localGit;
}
}
@Test
public void testCreateAndList() throws Exception {
@ -192,8 +193,7 @@ public class BranchCommandTest extends RepositoryTestCase {
@Test
public void testListAllBranchesShouldNotDie() throws Exception {
Git git = setUpRepoWithRemote();
git.branchList().setListMode(ListMode.ALL).call();
setUpRepoWithRemote().branchList().setListMode(ListMode.ALL).call();
}
@Test

Loading…
Cancel
Save