Java Code Examples for org.eclipse.jgit.api.RemoteSetUrlCommand#setName()

The following examples show how to use org.eclipse.jgit.api.RemoteSetUrlCommand#setName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractGitTest.java    From spring-cloud-contract with Apache License 2.0 6 votes vote down vote up
void setOriginOnProjectToTmp(File origin, File project, boolean push)
		throws GitAPIException, IOException, URISyntaxException {
	try (Git git = openGitProject(project)) {
		RemoteRemoveCommand remove = git.remoteRemove();
		remove.setName("origin");
		remove.call();
		RemoteSetUrlCommand command = git.remoteSetUrl();
		command.setUri(new URIish(origin.toURI().toURL()));
		command.setName("origin");
		command.setPush(push);
		command.call();
		StoredConfig config = git.getRepository().getConfig();
		RemoteConfig originConfig = new RemoteConfig(config, "origin");
		originConfig
				.addFetchRefSpec(new RefSpec("+refs/heads/*:refs/remotes/origin/*"));
		originConfig.update(config);
		config.save();
	}
}
 
Example 2
Source File: GitTestUtils.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
public static void setOriginOnProjectToTmp(File origin, File project)
		throws GitAPIException, MalformedURLException {
	try (Git git = openGitProject(project)) {
		RemoteRemoveCommand remove = git.remoteRemove();
		remove.setName("origin");
		remove.call();
		RemoteSetUrlCommand command = git.remoteSetUrl();
		command.setUri(new URIish(origin.toURI().toURL()));
		command.setName("origin");
		command.setPush(true);
		command.call();
	}
}
 
Example 3
Source File: GitTestUtils.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
public static void setOriginOnProjectToTmp(File origin, File project)
		throws GitAPIException, MalformedURLException {
	try (Git git = openGitProject(project)) {
		RemoteRemoveCommand remove = git.remoteRemove();
		remove.setName("origin");
		remove.call();
		RemoteSetUrlCommand command = git.remoteSetUrl();
		command.setUri(new URIish(origin.toURI().toURL()));
		command.setName("origin");
		command.setPush(true);
		command.call();
	}
}
 
Example 4
Source File: GitTestUtils.java    From spring-cloud-release-tools with Apache License 2.0 5 votes vote down vote up
public static void setOriginOnProjectToTmp(File origin, File project)
		throws GitAPIException, MalformedURLException {
	try (Git git = openGitProject(project)) {
		RemoteRemoveCommand remove = git.remoteRemove();
		remove.setName("origin");
		remove.call();
		RemoteSetUrlCommand command = git.remoteSetUrl();
		command.setUri(new URIish(origin.toURI().toURL()));
		command.setName("origin");
		command.setPush(true);
		command.call();
	}
}