summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 08:20:45 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 08:20:45 +0900
commit3fd6a3857b3aa16757fe6b09d94ef294555ffc8b (patch)
tree22b47b583979c23639d3bd391000cf6a0b249501 /org.eclipse.jgit.test
parentfd20f8c6579e3c90c598879f753c635fe5a54699 (diff)
downloadjgit-3fd6a3857b3aa16757fe6b09d94ef294555ffc8b.tar.gz
jgit-3fd6a3857b3aa16757fe6b09d94ef294555ffc8b.zip
CloneCommandTest: Open Repository in try-with-resource
Change-Id: Id09d2126fb17d84581f8637e83a75dfa2e85ebe8 Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java22
1 files changed, 11 insertions, 11 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
index e687a6ca7f..0d7009dca4 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
@@ -601,17 +601,17 @@ public class CloneCommandTest extends RepositoryTestCase {
SubmoduleWalk walk = SubmoduleWalk.forIndex(git2.getRepository());
assertTrue(walk.next());
- Repository clonedSub1 = walk.getRepository();
- assertNotNull(clonedSub1);
- assertEquals(
- new File(git2.getRepository().getWorkTree(), walk.getPath()),
- clonedSub1.getWorkTree());
- assertEquals(new File(new File(git2.getRepository().getDirectory(),
- "modules"), walk.getPath()),
- clonedSub1.getDirectory());
- status = new SubmoduleStatusCommand(clonedSub1);
- statuses = status.call();
- clonedSub1.close();
+ try (Repository clonedSub1 = walk.getRepository()) {
+ assertNotNull(clonedSub1);
+ assertEquals(new File(git2.getRepository().getWorkTree(),
+ walk.getPath()), clonedSub1.getWorkTree());
+ assertEquals(
+ new File(new File(git2.getRepository().getDirectory(),
+ "modules"), walk.getPath()),
+ clonedSub1.getDirectory());
+ status = new SubmoduleStatusCommand(clonedSub1);
+ statuses = status.call();
+ }
pathStatus = statuses.get(path);
assertNotNull(pathStatus);
assertEquals(SubmoduleStatusType.INITIALIZED, pathStatus.getType());