Browse Source

CloneCommandTest: Open Repository in try-with-resource

Change-Id: Id09d2126fb17d84581f8637e83a75dfa2e85ebe8
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.11
David Pursehouse 7 years ago
parent
commit
3fd6a3857b
  1. 10
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java

10
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()); SubmoduleWalk walk = SubmoduleWalk.forIndex(git2.getRepository());
assertTrue(walk.next()); assertTrue(walk.next());
Repository clonedSub1 = walk.getRepository(); try (Repository clonedSub1 = walk.getRepository()) {
assertNotNull(clonedSub1); assertNotNull(clonedSub1);
assertEquals(new File(git2.getRepository().getWorkTree(),
walk.getPath()), clonedSub1.getWorkTree());
assertEquals( assertEquals(
new File(git2.getRepository().getWorkTree(), walk.getPath()), new File(new File(git2.getRepository().getDirectory(),
clonedSub1.getWorkTree());
assertEquals(new File(new File(git2.getRepository().getDirectory(),
"modules"), walk.getPath()), "modules"), walk.getPath()),
clonedSub1.getDirectory()); clonedSub1.getDirectory());
status = new SubmoduleStatusCommand(clonedSub1); status = new SubmoduleStatusCommand(clonedSub1);
statuses = status.call(); statuses = status.call();
clonedSub1.close(); }
pathStatus = statuses.get(path); pathStatus = statuses.get(path);
assertNotNull(pathStatus); assertNotNull(pathStatus);
assertEquals(SubmoduleStatusType.INITIALIZED, pathStatus.getType()); assertEquals(SubmoduleStatusType.INITIALIZED, pathStatus.getType());

Loading…
Cancel
Save