summaryrefslogtreecommitdiff
path: root/include/git2
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-04-22 07:44:32 -0700
committerVicent Martí <vicent@github.com>2013-04-22 07:44:32 -0700
commita472f887fe8510bd972f8ce8bec6c9f53601aefb (patch)
treee9bc91e80f29479077b595aa138454e4a165063c /include/git2
parentf063a75882769cb6fc652de425ac16ba4b88b616 (diff)
parent1be680c4d0909ee5160292d7b56c4522c4bc309c (diff)
downloadlibgit2-a472f887fe8510bd972f8ce8bec6c9f53601aefb.tar.gz
Merge pull request #1493 from carlosmn/remotes
Revamp the refspec handling
Diffstat (limited to 'include/git2')
-rw-r--r--include/git2/refspec.h8
-rw-r--r--include/git2/remote.h43
2 files changed, 41 insertions, 10 deletions
diff --git a/include/git2/refspec.h b/include/git2/refspec.h
index ec7830b7c..3e1b502ef 100644
--- a/include/git2/refspec.h
+++ b/include/git2/refspec.h
@@ -36,6 +36,14 @@ GIT_EXTERN(const char *) git_refspec_src(const git_refspec *refspec);
GIT_EXTERN(const char *) git_refspec_dst(const git_refspec *refspec);
/**
+ * Get the refspec's string
+ *
+ * @param refspec the refspec
+ * @returns the refspec's original string
+ */
+GIT_EXTERN(const char *) git_refspec_string(const git_refspec *refspec);
+
+/**
* Get the force update setting
*
* @param refspec the refspec
diff --git a/include/git2/remote.h b/include/git2/remote.h
index 9494a8b01..5dcd93099 100644
--- a/include/git2/remote.h
+++ b/include/git2/remote.h
@@ -142,30 +142,44 @@ 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_fetch(git_remote *remote, const char *refspec);
/**
- * Get the fetch refspec
+ * Get the remote's list of fetch refspecs
*
- * @param remote the remote
- * @return a pointer to the fetch refspec or NULL if it doesn't exist
+ * The memory is owned by the user and should be freed with
+ * `git_strarray_free`.
+ *
+ * @param array pointer to the array in which to store the strings
+ * @param remote the remote to query
*/
-GIT_EXTERN(const git_refspec *) git_remote_fetchspec(const git_remote *remote);
+GIT_EXTERN(int) git_remote_get_fetch_refspecs(git_strarray *array, git_remote *remote);
/**
- * Set the remote's push refspec
+ * Add a push refspec to the remote
*
* @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_push(git_remote *remote, const char *refspec);
+
+/**
+ * Get the remote's list of push refspecs
+ *
+ * The memory is owned by the user and should be freed with
+ * `git_strarray_free`.
+ *
+ * @param array pointer to the array in which to store the strings
+ * @param remote the remote to query
+ */
+GIT_EXTERN(int) git_remote_get_push_refspecs(git_strarray *array, git_remote *remote);
/**
* Get the push refspec
@@ -177,6 +191,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