Search in sources :

Example 1 with ConfigurePushAfterCloneTask

use of org.eclipse.egit.core.op.ConfigurePushAfterCloneTask in project egit by eclipse.

the class CloneOperationTest method testConfigurePushAfterCloneTask.

@Test
public void testConfigurePushAfterCloneTask() throws Exception {
    URIish uri = new URIish("file:///" + repository1.getRepository().getDirectory().toString());
    CloneOperation clop = new CloneOperation(uri, true, null, workdir2, "refs/heads/master", "origin", 0);
    clop.addPostCloneTask(new ConfigurePushAfterCloneTask("origin", "HEAD:refs/for/master", new URIish("file:///pushtarget")));
    clop.run(null);
    Repository clonedRepo = FileRepositoryBuilder.create(new File(workdir2, Constants.DOT_GIT));
    assertEquals("", "HEAD:refs/for/master", clonedRepo.getConfig().getString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "push"));
    assertEquals("", "file:///pushtarget", clonedRepo.getConfig().getString(ConfigConstants.CONFIG_REMOTE_SECTION, "origin", "pushurl"));
}
Also used : URIish(org.eclipse.jgit.transport.URIish) ConfigurePushAfterCloneTask(org.eclipse.egit.core.op.ConfigurePushAfterCloneTask) TestRepository(org.eclipse.egit.core.test.TestRepository) Repository(org.eclipse.jgit.lib.Repository) File(java.io.File) CloneOperation(org.eclipse.egit.core.op.CloneOperation) Test(org.junit.Test)

Aggregations

File (java.io.File)1 CloneOperation (org.eclipse.egit.core.op.CloneOperation)1 ConfigurePushAfterCloneTask (org.eclipse.egit.core.op.ConfigurePushAfterCloneTask)1 TestRepository (org.eclipse.egit.core.test.TestRepository)1 Repository (org.eclipse.jgit.lib.Repository)1 URIish (org.eclipse.jgit.transport.URIish)1 Test (org.junit.Test)1