From 70f7484d2ae7ed4b5c4d074aa5e9f99ebeebdd77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 14 May 2015 09:35:08 +0200 Subject: remote: get rid of the run-time refspec setters These were left over from the culling as it's not clear which use-cases might benefit from this. It is not clear that we want to support any use-case which depends on changing the remote's idea of the base refspecs rather than passing in different per-operation refspec list, so remove these functions. --- include/git2/remote.h | 20 -------------------- 1 file changed, 20 deletions(-) (limited to 'include/git2/remote.h') diff --git a/include/git2/remote.h b/include/git2/remote.h index ab14ad4dc..36e9deb90 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -189,16 +189,6 @@ GIT_EXTERN(int) git_remote_add_fetch(git_repository *repo, const char *remote, c */ GIT_EXTERN(int) git_remote_get_fetch_refspecs(git_strarray *array, const git_remote *remote); -/** - * Set the remote's list of fetch refspecs - * - * The contents of the string array are copied. - * - * @param remote the remote to modify - * @param array the new list of fetch resfpecs - */ -GIT_EXTERN(int) git_remote_set_fetch_refspecs(git_remote *remote, git_strarray *array); - /** * Add a push refspec to the remote's configuration * @@ -223,16 +213,6 @@ GIT_EXTERN(int) git_remote_add_push(git_repository *repo, const char *remote, co */ GIT_EXTERN(int) git_remote_get_push_refspecs(git_strarray *array, const git_remote *remote); -/** - * Set the remote's list of push refspecs - * - * The contents of the string array are copied. - * - * @param remote the remote to modify - * @param array the new list of push resfpecs - */ -GIT_EXTERN(int) git_remote_set_push_refspecs(git_remote *remote, git_strarray *array); - /** * Get the number of refspecs for a remote * -- cgit v1.2.1 From ae5b93629c148dc96de7337095fba4b1e901ee2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 17 May 2015 15:11:45 +0200 Subject: remote: remove fetch parameter from create_anonymous An anonymous remote is not configured and cannot therefore have configured refspecs. Remove the parameter which adds this from the constructor. --- include/git2/remote.h | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'include/git2/remote.h') diff --git a/include/git2/remote.h b/include/git2/remote.h index 36e9deb90..86498a31a 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -63,24 +63,18 @@ GIT_EXTERN(int) git_remote_create_with_fetchspec( /** * Create an anonymous remote * - * Create a remote with the given url and refspec in memory. You can use - * this when you have a URL instead of a remote's name. Note that anonymous - * remotes cannot be converted to persisted remotes. + * Create a remote with the given url in-memory. You can use this when + * you have a URL instead of a remote's name. * - * The name, when provided, will be checked for validity. - * See `git_tag_create()` for rules about valid names. - * - * @param out pointer to the new remote object + * @param out pointer to the new remote objects * @param repo the associated repository * @param url the remote repository's URL - * @param fetch the fetch refspec to use for this remote. * @return 0 or an error code */ GIT_EXTERN(int) git_remote_create_anonymous( git_remote **out, git_repository *repo, - const char *url, - const char *fetch); + const char *url); /** * Get the information for a particular remote -- cgit v1.2.1 From c6e942fb3d10d9f8f2e22833ddddbd945c0d6604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Sun, 17 May 2015 15:19:22 +0200 Subject: remote: validate refspecs before adding to config When we moved from acting on the instance to acting on the configuration, we dropped the validation of the passed refspec, which can lead to writing an invalid refspec to the configuration. Bring that validation back. --- include/git2/remote.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/git2/remote.h') diff --git a/include/git2/remote.h b/include/git2/remote.h index 86498a31a..577a1c853 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -168,7 +168,7 @@ GIT_EXTERN(int) git_remote_set_pushurl(git_repository *repo, const char *remote, * @param repo the repository in which to change the configuration * @param remote the name of the remote to change * @param refspec the new fetch refspec - * @return 0 or an error value + * @return 0, GIT_EINVALIDSPEC if refspec is invalid or an error value */ GIT_EXTERN(int) git_remote_add_fetch(git_repository *repo, const char *remote, const char *refspec); @@ -192,7 +192,7 @@ GIT_EXTERN(int) git_remote_get_fetch_refspecs(git_strarray *array, const git_rem * @param repo the repository in which to change the configuration * @param remote the name of the remote to change * @param refspec the new push refspec - * @return 0 or an error value + * @return 0, GIT_EINVALIDSPEC if refspec is invalid or an error value */ GIT_EXTERN(int) git_remote_add_push(git_repository *repo, const char *remote, const char *refspec); -- cgit v1.2.1