summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-04-23 06:51:34 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2015-05-13 09:46:36 +0200
commit7725499072aaf4d9093c615fee5a65d8477100bc (patch)
treefc68cffcafe2d9e762729334dfe2f7a4ee15783e /include
parent3fec548a989b09fc7a2c30f42b1d4fa123a8867e (diff)
downloadlibgit2-7725499072aaf4d9093c615fee5a65d8477100bc.tar.gz
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.
Diffstat (limited to 'include')
-rw-r--r--include/git2/remote.h31
1 files changed, 12 insertions, 19 deletions
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
@@ -245,15 +247,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
*
* @param remote the remote