vendor/libgit2/src/refspec.c in rugged-0.27.7 vs vendor/libgit2/src/refspec.c in rugged-0.27.9
- old
+ new
@@ -14,11 +14,11 @@
#include "refs.h"
#include "vector.h"
int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
{
- /* Ported from https://github.com/git/git/blob/f06d47e7e0d9db709ee204ed13a8a7486149f494/remote.c#L518-636 */
+ // Ported from https://github.com/git/git/blob/f06d47e7e0d9db709ee204ed13a8a7486149f494/remote.c#L518-636
size_t llen;
int is_glob = 0;
const char *lhs, *rhs;
int flags;
@@ -142,15 +142,15 @@
invalid:
giterr_set(
GITERR_INVALID,
"'%s' is not a valid refspec.", input);
- git_refspec__dispose(refspec);
+ git_refspec__free(refspec);
return -1;
}
-void git_refspec__dispose(git_refspec *refspec)
+void git_refspec__free(git_refspec *refspec)
{
if (refspec == NULL)
return;
git__free(refspec->src);
@@ -158,35 +158,10 @@
git__free(refspec->string);
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__dispose(refspec);
- git__free(refspec);
-}
-
const char *git_refspec_src(const git_refspec *refspec)
{
return refspec == NULL ? NULL : refspec->src;
}
@@ -275,11 +250,11 @@
giterr_set(GITERR_INVALID, "ref '%s' doesn't match the source", name);
return -1;
}
if (!spec->pattern)
- return git_buf_puts(out, spec->dst ? spec->dst : "");
+ return git_buf_puts(out, spec->dst);
return refspec_transform(out, spec->src, spec->dst, name);
}
int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *name)
@@ -382,10 +357,10 @@
GITERR_CHECK_ALLOC_BUF(&buf);
cur->dst = git_buf_detach(&buf);
}
- git_buf_dispose(&buf);
+ git_buf_free(&buf);
if (cur->dst == NULL && spec->dst != NULL) {
cur->dst = git__strdup(spec->dst);
GITERR_CHECK_ALLOC(cur->dst);
}