Browse Source

GitConstructionTest: Open Git instance in try-with-resource

Change-Id: Iddf658acd1c78161d6028cfcfb7e5c73534ae40b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
stable-4.2
David Pursehouse 9 years ago
parent
commit
130cf0d61a
  1. 11
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java

11
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java

@ -66,11 +66,12 @@ public class GitConstructionTest extends RepositoryTestCase {
@Before
public void setUp() throws Exception {
super.setUp();
Git git = new Git(db);
git.commit().setMessage("initial commit").call();
writeTrashFile("Test.txt", "Hello world");
git.add().addFilepattern("Test.txt").call();
git.commit().setMessage("Initial commit").call();
try (Git git = new Git(db)) {
git.commit().setMessage("initial commit").call();
writeTrashFile("Test.txt", "Hello world");
git.add().addFilepattern("Test.txt").call();
git.commit().setMessage("Initial commit").call();
}
bareRepo = Git.cloneRepository().setBare(true)
.setURI(db.getDirectory().toURI().toString())

Loading…
Cancel
Save