diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/refspec.c | 7 | ||||
-rw-r--r-- | src/remote.c | 27 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c index 256540819..a907df84c 100644 --- a/src/refspec.c +++ b/src/refspec.c @@ -274,3 +274,10 @@ int git_refspec_is_wildcard(const git_refspec *spec) return (spec->src[strlen(spec->src) - 1] == '*'); } + +git_direction git_refspec_direction(const git_refspec *spec) +{ + assert(spec); + + return spec->push; +} diff --git a/src/remote.c b/src/remote.c index 1183137a6..08f56cd51 100644 --- a/src/remote.c +++ b/src/remote.c @@ -8,6 +8,7 @@ #include "git2/config.h" #include "git2/types.h" #include "git2/oid.h" +#include "git2/net.h" #include "config.h" #include "repository.h" @@ -691,6 +692,7 @@ static int dwim_refspecs(git_vector *refspecs, git_vector *refs) spec->dwim = 1; } + git_buf_free(&buf); return 0; } @@ -1574,3 +1576,28 @@ int git_remote_get_push_refspecs(git_strarray *array, git_remote *remote) { return copy_refspecs(array, remote, true); } + +size_t git_remote_refspec_count(git_remote *remote) +{ + return remote->refspecs.length; +} + +const git_refspec *git_remote_get_refspec(git_remote *remote, size_t n) +{ + return git_vector_get(&remote->refspecs, n); +} + +int git_remote_remove_refspec(git_remote *remote, size_t n) +{ + git_refspec *spec; + + assert(remote); + + spec = git_vector_get(&remote->refspecs, n); + if (spec) { + git_refspec__free(spec); + git__free(spec); + } + + return git_vector_remove(&remote->refspecs, n); +} |