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. 22
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java

22
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());

Loading…
Cancel
Save