Search in sources :

Example 1 with RemoteUpdateParams

use of org.eclipse.che.api.git.params.RemoteUpdateParams in project che by eclipse.

the class RemoteUpdateTest method testUpdateBranches.

@Test(dataProvider = "GitConnectionFactory", dataProviderClass = GitConnectionFactoryProvider.class)
public void testUpdateBranches(GitConnectionFactory connectionFactory) throws GitException, IOException {
    //given
    GitConnection connection = connectToGitRepositoryWithContent(connectionFactory, repository);
    addInitialRemote(connection);
    //when
    //change branch1 to branch2
    RemoteUpdateParams request = RemoteUpdateParams.create("newRemote").withBranches(singletonList("branch2"));
    connection.remoteUpdate(request);
    //then
    assertEquals(parseAllConfig(connection).get("remote.newRemote.fetch").get(0), "+refs/heads/branch2:refs/remotes/newRemote/branch2");
}
Also used : RemoteUpdateParams(org.eclipse.che.api.git.params.RemoteUpdateParams) GitConnection(org.eclipse.che.api.git.GitConnection) Test(org.testng.annotations.Test)

Aggregations

GitConnection (org.eclipse.che.api.git.GitConnection)1 RemoteUpdateParams (org.eclipse.che.api.git.params.RemoteUpdateParams)1 Test (org.testng.annotations.Test)1