diff options
author | Vicent Martà <vicent@github.com> | 2013-04-30 03:29:48 -0700 |
---|---|---|
committer | Vicent Martà <vicent@github.com> | 2013-04-30 03:29:48 -0700 |
commit | d76fb20ebce03b2fd87c2472d556bf9b64894efd (patch) | |
tree | 53ee85c45fce967dc183264ad66ecd78215f323e /include/git2 | |
parent | 099c1b747a15d3267dc4be533f08fe8435251708 (diff) | |
parent | 9c5d4b2e807cdbb83cf55868700b0387cd4e8c41 (diff) | |
download | libgit2-d76fb20ebce03b2fd87c2472d556bf9b64894efd.tar.gz |
Merge pull request #1520 from carlosmn/nth-refspec
Add refspec list accessors
Diffstat (limited to 'include/git2')
-rw-r--r-- | include/git2/refspec.h | 9 | ||||
-rw-r--r-- | include/git2/remote.h | 26 |
2 files changed, 35 insertions, 0 deletions
diff --git a/include/git2/refspec.h b/include/git2/refspec.h index 3e1b502ef..c0b410cbf 100644 --- a/include/git2/refspec.h +++ b/include/git2/refspec.h @@ -9,6 +9,7 @@ #include "common.h" #include "types.h" +#include "net.h" /** * @file git2/refspec.h @@ -52,6 +53,14 @@ GIT_EXTERN(const char *) git_refspec_string(const git_refspec *refspec); GIT_EXTERN(int) git_refspec_force(const git_refspec *refspec); /** + * Get the refspec's direction. + * + * @param the refspec + * @return GIT_DIRECTION_FETCH or GIT_DIRECTION_PUSH + */ +GIT_EXTERN(git_direction) git_refspec_direction(const git_refspec *spec); + +/** * Check if a refspec's source descriptor matches a reference * * @param refspec the refspec diff --git a/include/git2/remote.h b/include/git2/remote.h index f02b95678..2aa384a54 100644 --- a/include/git2/remote.h +++ b/include/git2/remote.h @@ -191,6 +191,32 @@ GIT_EXTERN(int) git_remote_get_push_refspecs(git_strarray *array, git_remote *re GIT_EXTERN(void) git_remote_clear_refspecs(git_remote *remote); /** + * Get the number of refspecs for a remote + * + * @param remote the remote + * @return the amount of refspecs configured in this remote + */ +GIT_EXTERN(size_t) git_remote_refspec_count(git_remote *remote); + +/** + * Get a refspec from the remote + * + * @param remote the remote to query + * @param n the refspec to get + * @return the nth refspec + */ +GIT_EXTERN(const git_refspec *)git_remote_get_refspec(git_remote *remote, size_t n); + +/** + * Remove a refspec from the remote + * + * @param remote the remote to query + * @param n the refspec to remove + * @return 0 or GIT_ENOTFOUND + */ +GIT_EXTERN(int) git_remote_remove_refspec(git_remote *remote, size_t n); + +/** * Open a connection to a remote * * The transport is selected based on the URL. The direction argument |