Browse Source

Merge "Add new submodule layout to SubmoduleAddCommand"

stable-4.1
Christian Halstrick 10 years ago committed by Gerrit Code Review @ Eclipse.org
parent
commit
f9380fb479
  1. 11
      org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java
  2. 2
      org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java

11
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CloneCommandTest.java

@ -391,6 +391,17 @@ public class CloneCommandTest extends RepositoryTestCase {
git.add().addFilepattern(path)
.addFilepattern(Constants.DOT_GIT_MODULES).call();
git.commit().setMessage("adding submodule").call();
try (SubmoduleWalk walk = SubmoduleWalk.forIndex(git.getRepository())) {
assertTrue(walk.next());
Repository subRepo = walk.getRepository();
addRepoToClose(subRepo);
assertNotNull(subRepo);
assertEquals(
new File(git.getRepository().getWorkTree(), walk.getPath()),
subRepo.getWorkTree());
assertEquals(new File(new File(git.getRepository().getDirectory(),
"modules"), walk.getPath()), subRepo.getDirectory());
}
File directory = createTempDirectory("testCloneRepositoryWithSubmodules");
CloneCommand clone = Git.cloneRepository();

2
org.eclipse.jgit/src/org/eclipse/jgit/api/SubmoduleAddCommand.java

@ -173,6 +173,8 @@ public class SubmoduleAddCommand extends
CloneCommand clone = Git.cloneRepository();
configure(clone);
clone.setDirectory(moduleDirectory);
clone.setGitDir(new File(new File(repo.getDirectory(),
Constants.MODULES), path));
clone.setURI(resolvedUri);
if (monitor != null)
clone.setProgressMonitor(monitor);

Loading…
Cancel
Save