mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-13 23:05:27 +00:00
Remotes: Setter for url+pushurl; Getter for pushurl
This commit is contained in:
parent
3ed4b5012b
commit
765015902a
@ -79,6 +79,36 @@ GIT_EXTERN(const char *) git_remote_name(git_remote *remote);
|
|||||||
*/
|
*/
|
||||||
GIT_EXTERN(const char *) git_remote_url(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
|
* Set the remote's fetch refspec
|
||||||
*
|
*
|
||||||
|
32
src/remote.c
32
src/remote.c
@ -269,6 +269,38 @@ const char *git_remote_url(git_remote *remote)
|
|||||||
return remote->url;
|
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)
|
int git_remote_set_fetchspec(git_remote *remote, const char *spec)
|
||||||
{
|
{
|
||||||
git_refspec refspec;
|
git_refspec refspec;
|
||||||
|
Loading…
Reference in New Issue
Block a user