diff options
| author | cynecx <me@cynecx.net> | 2018-02-07 22:30:27 +0100 |
|---|---|---|
| committer | cynecx <me@cynecx.net> | 2018-06-22 13:19:40 +0200 |
| commit | 630a67366eb475003b46bf56dc06b90197458259 (patch) | |
| tree | bae222f4a514b067f0c83c81f33bab6b97023029 /src/refspec.c | |
| parent | b121b7ac972156cdc67b25be075fd62450b57f29 (diff) | |
| download | libgit2-630a67366eb475003b46bf56dc06b90197458259.tar.gz | |
refspec: add public parsing api
Fix typo
Fix some type issues
More fixes
Address requested changes
Add test
Fix naming
Fix condition and tests
Address requested changes
Fix typo
Diffstat (limited to 'src/refspec.c')
| -rw-r--r-- | src/refspec.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/refspec.c b/src/refspec.c index 8061788d1..b058d5fc1 100644 --- a/src/refspec.c +++ b/src/refspec.c @@ -160,6 +160,31 @@ void git_refspec__free(git_refspec *refspec) memset(refspec, 0x0, sizeof(git_refspec)); } +int git_refspec_parse(git_refspec **out_refspec, const char *input, int is_fetch) +{ + git_refspec *refspec; + assert(out_refspec && input); + + *out_refspec = NULL; + + refspec = git__malloc(sizeof(git_refspec)); + GITERR_CHECK_ALLOC(refspec); + + if (git_refspec__parse(refspec, input, !!is_fetch) != 0) { + git__free(refspec); + return -1; + } + + *out_refspec = refspec; + return 0; +} + +void git_refspec_free(git_refspec *refspec) +{ + git_refspec__free(refspec); + git__free(refspec); +} + const char *git_refspec_src(const git_refspec *refspec) { return refspec == NULL ? NULL : refspec->src; |
