From 7725499072aaf4d9093c615fee5a65d8477100bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 23 Apr 2015 06:51:34 +0200 Subject: remote: remove live changing of refspecs The base refspecs changing can be a cause of confusion as to what is the current base refspec set and complicate saving the remote's configuration. Change `git_remote_add_{fetch,push}()` to update the configuration instead of an instance. This finally makes `git_remote_save()` a no-op, it will be removed in a later commit. --- include/git2/remote.h | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'include') diff --git a/include/git2/remote.h b/include/git2/remote.h index e2350f4f5..73440a966 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -179,16 +179,17 @@ GIT_EXTERN(int) git_remote_set_url(git_repository *repo, const char *remote, con GIT_EXTERN(int) git_remote_set_pushurl(git_repository *repo, const char *remote, const char* url); /** - * Add a fetch refspec to the remote + * Add a fetch refspec to the remote's configuration * - * Convenience function for adding a single fetch refspec to the - * current list in the remote. + * Add the given refspec to the fetch list in the configuration. No + * loaded remote instances will be affected. * - * @param remote the 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 */ -GIT_EXTERN(int) git_remote_add_fetch(git_remote *remote, const char *refspec); +GIT_EXTERN(int) git_remote_add_fetch(git_repository *repo, const char *remote, const char *refspec); /** * Get the remote's list of fetch refspecs @@ -212,16 +213,17 @@ GIT_EXTERN(int) git_remote_get_fetch_refspecs(git_strarray *array, const git_rem GIT_EXTERN(int) git_remote_set_fetch_refspecs(git_remote *remote, git_strarray *array); /** - * Add a push refspec to the remote + * Add a push refspec to the remote's configuration * - * Convenience function for adding a single push refspec to the - * current list in the remote. + * Add the given refspec to the push list in the configuration. No + * loaded remote instances will be affected. * - * @param remote the remote + * @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 */ -GIT_EXTERN(int) git_remote_add_push(git_remote *remote, const char *refspec); +GIT_EXTERN(int) git_remote_add_push(git_repository *repo, const char *remote, const char *refspec); /** * Get the remote's list of push refspecs @@ -244,15 +246,6 @@ GIT_EXTERN(int) git_remote_get_push_refspecs(git_strarray *array, const git_remo */ GIT_EXTERN(int) git_remote_set_push_refspecs(git_remote *remote, git_strarray *array); -/** - * Clear the refspecs - * - * Remove all configured fetch and push refspecs from the remote. - * - * @param remote the remote - */ -GIT_EXTERN(void) git_remote_clear_refspecs(git_remote *remote); - /** * Get the number of refspecs for a remote * -- cgit v1.2.1