Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse2016-02-15 03:07:22 -0500
committerDavid Pursehouse2016-02-15 03:07:22 -0500
commit130cf0d61aba0eff821c001b42bf87e50f590d54 (patch)
tree554c283e46ab414b597f895e5685e7b66bd682f6
parentf23b0fd7e6cd99ca904182e78055070d3ff0cf60 (diff)
downloadjgit-130cf0d61aba0eff821c001b42bf87e50f590d54.tar.gz
jgit-130cf0d61aba0eff821c001b42bf87e50f590d54.tar.xz
jgit-130cf0d61aba0eff821c001b42bf87e50f590d54.zip
GitConstructionTest: Open Git instance in try-with-resource
Change-Id: Iddf658acd1c78161d6028cfcfb7e5c73534ae40b Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/GitConstructionTest.java11
1 files changed, 6 insertions, 5 deletions
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())

Back to the top