From: David Pursehouse Date: Mon, 15 Feb 2016 08:07:22 +0000 (+0900) Subject: GitConstructionTest: Open Git instance in try-with-resource X-Git-Tag: v4.3.0.201603230630-rc1~20^2~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fchanges%2F87%2F66587%2F1;p=jgit.git GitConstructionTest: Open Git instance in try-with-resource Change-Id: Iddf658acd1c78161d6028cfcfb7e5c73534ae40b Signed-off-by: David Pursehouse --- diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java index 2220a536f1..3bff8f2ff6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java +++ b/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())