|
|
@ -76,6 +76,7 @@ import org.eclipse.jgit.submodule.SubmoduleStatusType; |
|
|
|
import org.eclipse.jgit.submodule.SubmoduleWalk; |
|
|
|
import org.eclipse.jgit.submodule.SubmoduleWalk; |
|
|
|
import org.eclipse.jgit.transport.RefSpec; |
|
|
|
import org.eclipse.jgit.transport.RefSpec; |
|
|
|
import org.eclipse.jgit.transport.RemoteConfig; |
|
|
|
import org.eclipse.jgit.transport.RemoteConfig; |
|
|
|
|
|
|
|
import org.eclipse.jgit.transport.URIish; |
|
|
|
import org.eclipse.jgit.util.SystemReader; |
|
|
|
import org.eclipse.jgit.util.SystemReader; |
|
|
|
import org.junit.Test; |
|
|
|
import org.junit.Test; |
|
|
|
|
|
|
|
|
|
|
@ -145,15 +146,35 @@ public class CloneCommandTest extends RepositoryTestCase { |
|
|
|
File directory = createTempDirectory("testCloneRepository"); |
|
|
|
File directory = createTempDirectory("testCloneRepository"); |
|
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
|
command.setDirectory(directory); |
|
|
|
command.setDirectory(directory); |
|
|
|
command.setGitDir(new File(directory, ".git")); |
|
|
|
command.setGitDir(new File(directory, Constants.DOT_GIT)); |
|
|
|
command.setURI(fileUri()); |
|
|
|
command.setURI(fileUri()); |
|
|
|
Git git2 = command.call(); |
|
|
|
Git git2 = command.call(); |
|
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
assertEquals(directory, git2.getRepository().getWorkTree()); |
|
|
|
assertEquals(directory, git2.getRepository().getWorkTree()); |
|
|
|
assertEquals(new File(directory, ".git"), git2.getRepository() |
|
|
|
assertEquals(new File(directory, Constants.DOT_GIT), git2.getRepository() |
|
|
|
.getDirectory()); |
|
|
|
.getDirectory()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testCloneRepositoryDefaultDirectory() throws IOException, URISyntaxException, |
|
|
|
|
|
|
|
JGitInternalException, GitAPIException { |
|
|
|
|
|
|
|
CloneCommand command = Git.cloneRepository().setURI(fileUri()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command.verifyDirectories(new URIish(fileUri())); |
|
|
|
|
|
|
|
File directory = command.getDirectory(); |
|
|
|
|
|
|
|
assertEquals(git.getRepository().getWorkTree().getName(), directory.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testCloneBareRepositoryDefaultDirectory() throws IOException, URISyntaxException, |
|
|
|
|
|
|
|
JGitInternalException, GitAPIException { |
|
|
|
|
|
|
|
CloneCommand command = Git.cloneRepository().setURI(fileUri()).setBare(true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command.verifyDirectories(new URIish(fileUri())); |
|
|
|
|
|
|
|
File directory = command.getDirectory(); |
|
|
|
|
|
|
|
assertEquals(git.getRepository().getWorkTree().getName() + Constants.DOT_GIT_EXT, directory.getName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
public void testCloneRepositoryExplicitGitDirNonStd() throws IOException, |
|
|
|
public void testCloneRepositoryExplicitGitDirNonStd() throws IOException, |
|
|
|
JGitInternalException, GitAPIException { |
|
|
|
JGitInternalException, GitAPIException { |
|
|
@ -168,8 +189,8 @@ public class CloneCommandTest extends RepositoryTestCase { |
|
|
|
assertEquals(directory, git2.getRepository().getWorkTree()); |
|
|
|
assertEquals(directory, git2.getRepository().getWorkTree()); |
|
|
|
assertEquals(gDir, git2.getRepository() |
|
|
|
assertEquals(gDir, git2.getRepository() |
|
|
|
.getDirectory()); |
|
|
|
.getDirectory()); |
|
|
|
assertTrue(new File(directory, ".git").isFile()); |
|
|
|
assertTrue(new File(directory, Constants.DOT_GIT).isFile()); |
|
|
|
assertFalse(new File(gDir, ".git").exists()); |
|
|
|
assertFalse(new File(gDir, Constants.DOT_GIT).exists()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|