summaryrefslogtreecommitdiff
path: root/include/git2/remote.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-04-20 04:43:28 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-04-20 17:54:13 +0200
commit4330ab26b53c0e1bf8cbb5e65704f65e3d116eba (patch)
tree14bf8d854854298bfe43b3a02c8c26f59377c988 /include/git2/remote.h
parente5a27f039ee3ae1291fd5084707c3f9c168f10ba (diff)
downloadlibgit2-4330ab26b53c0e1bf8cbb5e65704f65e3d116eba.tar.gz
remote: handle multiple refspecs
A remote can have a multitude of refspecs. Up to now our git_remote's have supported a single one for each fetch and push out of simplicity to get something working. Let the remotes and internal code know about multiple remotes and get the tests passing with them. Instead of setting a refspec, the external users can clear all and add refspecs. This should be enough for most uses, though we're still missing a querying function.
Diffstat (limited to 'include/git2/remote.h')
-rw-r--r--include/git2/remote.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 9494a8b01..7a161796f 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -142,30 +142,22 @@ GIT_EXTERN(int) git_remote_set_url(git_remote *remote, const char* url);
GIT_EXTERN(int) git_remote_set_pushurl(git_remote *remote, const char* url);
/**
- * Set the remote's fetch refspec
+ * Add a fetch refspec to the remote
*
* @param remote the remote
- * @apram spec the new fetch refspec
+ * @apram refspec the new fetch refspec
* @return 0 or an error value
*/
-GIT_EXTERN(int) git_remote_set_fetchspec(git_remote *remote, const char *spec);
+GIT_EXTERN(int) git_remote_add_fetchspec(git_remote *remote, const char *refspec);
/**
- * Get the fetch refspec
+ * Add a push refspec to the remote
*
* @param remote the remote
- * @return a pointer to the fetch refspec or NULL if it doesn't exist
- */
-GIT_EXTERN(const git_refspec *) git_remote_fetchspec(const git_remote *remote);
-
-/**
- * Set the remote's push refspec
- *
- * @param remote the remote
- * @param spec the new push refspec
+ * @param refspec the new push refspec
* @return 0 or an error value
*/
-GIT_EXTERN(int) git_remote_set_pushspec(git_remote *remote, const char *spec);
+GIT_EXTERN(int) git_remote_add_pushspec(git_remote *remote, const char *refspec);
/**
* Get the push refspec
@@ -177,6 +169,15 @@ GIT_EXTERN(int) git_remote_set_pushspec(git_remote *remote, const char *spec);
GIT_EXTERN(const git_refspec *) git_remote_pushspec(const git_remote *remote);
/**
+ * 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);
+
+/**
* Open a connection to a remote
*
* The transport is selected based on the URL. The direction argument