From 53ff0529988ae8ec6f75a1f3d1b7b75de7dc304f Mon Sep 17 00:00:00 2001 From: Christian Halstrick Date: Wed, 10 Dec 2014 17:54:28 +0100 Subject: Support the new repository layout for submodules When updating a submodule (e.g. during recursive clone) the repository for the submodule should be located at /modules/ whereas the working tree of the submodule should be located at / ( and are associated to the containing repository). Since CloneCommand has learned about specifying a separate gitdir this is easy to implement in SubmoduleUpdateCommand. Change-Id: I9b56a3dfa50f97f6975c2bb7c97b36296f331b64 --- .../tst/org/eclipse/jgit/api/CloneCommandTest.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'org.eclipse.jgit.test/tst/org') 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 06829fa4db..ece1b324b0 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 @@ -410,6 +410,18 @@ public class CloneCommandTest extends RepositoryTestCase { assertEquals(SubmoduleStatusType.INITIALIZED, pathStatus.getType()); assertEquals(commit, pathStatus.getHeadId()); assertEquals(commit, pathStatus.getIndexId()); + + SubmoduleWalk walk = SubmoduleWalk.forIndex(git2.getRepository()); + assertTrue(walk.next()); + Repository clonedSub1 = walk.getRepository(); + addRepoToClose(clonedSub1); + 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()); + walk.release(); } @Test @@ -492,6 +504,12 @@ public class CloneCommandTest extends RepositoryTestCase { 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(); -- cgit v1.2.3