|
|
|
|
|
|
|
|
File directory = createTempDirectory("testCloneRepository"); |
|
|
File directory = createTempDirectory("testCloneRepository"); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertNotNull(git2); |
|
|
assertNotNull(git2); |
|
|
|
|
|
|
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setBare(true); |
|
|
command.setBare(true); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertEquals(new RefSpec("+refs/heads/*:refs/heads/*"), |
|
|
assertEquals(new RefSpec("+refs/heads/*:refs/heads/*"), |
|
|
|
|
|
|
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setBranch("refs/heads/master"); |
|
|
command.setBranch("refs/heads/master"); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command = Git.cloneRepository(); |
|
|
command = Git.cloneRepository(); |
|
|
command.setBranch("refs/heads/master"); |
|
|
command.setBranch("refs/heads/master"); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
command.setNoCheckout(true); |
|
|
command.setNoCheckout(true); |
|
|
git2 = command.call(); |
|
|
git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
|
|
|
|
|
command = Git.cloneRepository(); |
|
|
command = Git.cloneRepository(); |
|
|
command.setBranch("refs/heads/master"); |
|
|
command.setBranch("refs/heads/master"); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
command.setBare(true); |
|
|
command.setBare(true); |
|
|
git2 = command.call(); |
|
|
git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
|
|
|
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setBranch("test"); |
|
|
command.setBranch("test"); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setBranch("tag-initial"); |
|
|
command.setBranch("tag-initial"); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
command.setBranchesToClone(Collections |
|
|
command.setBranchesToClone(Collections |
|
|
.singletonList("refs/heads/master")); |
|
|
.singletonList("refs/heads/master")); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertNotNull(git2); |
|
|
assertNotNull(git2); |
|
|
|
|
|
|
|
|
command.setBranchesToClone(Collections |
|
|
command.setBranchesToClone(Collections |
|
|
.singletonList("refs/heads/master")); |
|
|
.singletonList("refs/heads/master")); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
command.setBare(true); |
|
|
command.setBare(true); |
|
|
git2 = command.call(); |
|
|
git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
|
|
|
|
|
|
File directory = createTempDirectory(dirName); |
|
|
File directory = createTempDirectory(dirName); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertNotNull(git2); |
|
|
assertNotNull(git2); |
|
|
// clone again |
|
|
// clone again |
|
|
command = Git.cloneRepository(); |
|
|
command = Git.cloneRepository(); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
try { |
|
|
try { |
|
|
git2 = command.call(); |
|
|
git2 = command.call(); |
|
|
// we shouldn't get here |
|
|
// we shouldn't get here |
|
|
|
|
|
|
|
|
File directory = createTempDirectory("testCloneRepositoryWithMultipleHeadBranches"); |
|
|
File directory = createTempDirectory("testCloneRepositoryWithMultipleHeadBranches"); |
|
|
CloneCommand clone = Git.cloneRepository(); |
|
|
CloneCommand clone = Git.cloneRepository(); |
|
|
clone.setDirectory(directory); |
|
|
clone.setDirectory(directory); |
|
|
clone.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
clone.setURI(fileUri()); |
|
|
Git git2 = clone.call(); |
|
|
Git git2 = clone.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertNotNull(git2); |
|
|
assertNotNull(git2); |
|
|
|
|
|
|
|
|
CloneCommand clone = Git.cloneRepository(); |
|
|
CloneCommand clone = Git.cloneRepository(); |
|
|
clone.setDirectory(directory); |
|
|
clone.setDirectory(directory); |
|
|
clone.setCloneSubmodules(true); |
|
|
clone.setCloneSubmodules(true); |
|
|
clone.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
clone.setURI(fileUri()); |
|
|
Git git2 = clone.call(); |
|
|
Git git2 = clone.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertNotNull(git2); |
|
|
assertNotNull(git2); |
|
|
|
|
|
|
|
|
File directory = createTempDirectory("testCloneRepository1"); |
|
|
File directory = createTempDirectory("testCloneRepository1"); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
CloneCommand command = Git.cloneRepository(); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
Git git2 = command.call(); |
|
|
Git git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertFalse(git2 |
|
|
assertFalse(git2 |
|
|
|
|
|
|
|
|
directory = createTempDirectory("testCloneRepository2"); |
|
|
directory = createTempDirectory("testCloneRepository2"); |
|
|
command = Git.cloneRepository(); |
|
|
command = Git.cloneRepository(); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
git2 = command.call(); |
|
|
git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertTrue(git2 |
|
|
assertTrue(git2 |
|
|
|
|
|
|
|
|
directory = createTempDirectory("testCloneRepository2"); |
|
|
directory = createTempDirectory("testCloneRepository2"); |
|
|
command = Git.cloneRepository(); |
|
|
command = Git.cloneRepository(); |
|
|
command.setDirectory(directory); |
|
|
command.setDirectory(directory); |
|
|
command.setURI("file://" + git.getRepository().getWorkTree().getPath()); |
|
|
|
|
|
|
|
|
command.setURI(fileUri()); |
|
|
git2 = command.call(); |
|
|
git2 = command.call(); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
addRepoToClose(git2.getRepository()); |
|
|
assertTrue(git2 |
|
|
assertTrue(git2 |
|
|
|
|
|
|
|
|
ConfigConstants.CONFIG_KEY_REBASE, false)); |
|
|
ConfigConstants.CONFIG_KEY_REBASE, false)); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private String fileUri() { |
|
|
|
|
|
return "file://" + git.getRepository().getWorkTree().getAbsolutePath(); |
|
|
|
|
|
} |
|
|
} |
|
|
} |