Commit 76501590 by Sascha Cunz

Remotes: Setter for url+pushurl; Getter for pushurl

parent 3ed4b501
......@@ -80,6 +80,36 @@ GIT_EXTERN(const char *) git_remote_name(git_remote *remote);
GIT_EXTERN(const char *) git_remote_url(git_remote *remote);
/**
* Get the remote's url for pushing
*
* @param remote the remote
* @return a pointer to the url or NULL if no special url for pushing is set
*/
GIT_EXTERN(const char *) git_remote_pushurl(git_remote *remote);
/**
* Set the remote's url
*
* Existing connections will not be updated.
*
* @param remote the remote
* @param url the url to set
* @return 0 or an error value
*/
GIT_EXTERN(int) git_remote_set_url(git_remote *remote, const char* url);
/**
* Set the remote's url for pushing
*
* Existing connections will not be updated.
*
* @param remote the remote
* @param url the url to set or NULL to clear the pushurl
* @return 0 or an error value
*/
GIT_EXTERN(int) git_remote_set_pushurl(git_remote *remote, const char* url);
/**
* Set the remote's fetch refspec
*
* @param remote the remote
......
......@@ -269,6 +269,38 @@ const char *git_remote_url(git_remote *remote)
return remote->url;
}
int git_remote_set_url(git_remote *remote, const char* url)
{
assert(remote);
assert(url);
git__free(remote->url);
remote->url = git__strdup(url);
GITERR_CHECK_ALLOC(remote->url);
return 0;
}
const char *git_remote_pushurl(git_remote *remote)
{
assert(remote);
return remote->pushurl;
}
int git_remote_set_pushurl(git_remote *remote, const char* url)
{
assert(remote);
git__free(remote->pushurl);
if (url) {
remote->pushurl = git__strdup(url);
GITERR_CHECK_ALLOC(remote->pushurl);
} else {
remote->pushurl = NULL;
}
return 0;
}
int git_remote_set_fetchspec(git_remote *remote, const char *spec)
{
git_refspec refspec;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment