summaryrefslogtreecommitdiff
path: root/src/push.c
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2018-12-27 13:47:34 -0600
committerEdward Thomson <ethomson@edwardthomson.com>2019-01-22 22:30:35 +0000
commitf673e232afe22eb865cdc915e55a2df6493f0fbb (patch)
treee79e3e6fb1e1d78367679aea75e66c8141b4daa8 /src/push.c
parent647dfdb42d06514a85c1499f1be88a32b8a4c24b (diff)
downloadlibgit2-f673e232afe22eb865cdc915e55a2df6493f0fbb.tar.gz
git_error: use new names in internal APIs and usage
Move to the `git_error` name in the internal API for error-related functions.
Diffstat (limited to 'src/push.c')
-rw-r--r--src/push.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/push.c b/src/push.c
index 0ba4d9830..9d09e18bb 100644
--- a/src/push.c
+++ b/src/push.c
@@ -36,7 +36,7 @@ int git_push_new(git_push **out, git_remote *remote)
*out = NULL;
p = git__calloc(1, sizeof(*p));
- GITERR_CHECK_ALLOC(p);
+ GIT_ERROR_CHECK_ALLOC(p);
p->repo = remote->repo;
p->remote = remote;
@@ -70,7 +70,7 @@ int git_push_set_options(git_push *push, const git_push_options *opts)
if (!push || !opts)
return -1;
- GITERR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
+ GIT_ERROR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
push->pb_parallelism = opts->pb_parallelism;
push->connection.custom_headers = &opts->custom_headers;
@@ -91,7 +91,7 @@ static void free_refspec(push_spec *spec)
static int check_rref(char *ref)
{
if (git__prefixcmp(ref, "refs/")) {
- giterr_set(GITERR_INVALID, "not a valid reference '%s'", ref);
+ git_error_set(GIT_ERROR_INVALID, "not a valid reference '%s'", ref);
return -1;
}
@@ -109,10 +109,10 @@ static int check_lref(git_push *push, char *ref)
return 0;
if (error == GIT_ENOTFOUND)
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"src refspec '%s' does not match any existing object", ref);
else
- giterr_set(GITERR_INVALID, "not a valid reference '%s'", ref);
+ git_error_set(GIT_ERROR_INVALID, "not a valid reference '%s'", ref);
return -1;
}
@@ -123,10 +123,10 @@ static int parse_refspec(git_push *push, push_spec **spec, const char *str)
*spec = NULL;
s = git__calloc(1, sizeof(*s));
- GITERR_CHECK_ALLOC(s);
+ GIT_ERROR_CHECK_ALLOC(s);
if (git_refspec__parse(&s->refspec, str, false) < 0) {
- giterr_set(GITERR_INVALID, "invalid refspec %s", str);
+ git_error_set(GIT_ERROR_INVALID, "invalid refspec %s", str);
goto on_error;
}
@@ -213,7 +213,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
if (error != GIT_ENOTFOUND)
goto on_error;
- giterr_clear();
+ git_error_clear();
fire_callback = 0;
}
@@ -323,7 +323,7 @@ static int queue_objects(git_push *push)
continue;
if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"cannot push because a reference that you are trying to update on the remote contains commits that are not present locally.");
error = GIT_ENONFASTFORWARD;
goto on_error;
@@ -334,7 +334,7 @@ static int queue_objects(git_push *push)
if (error == GIT_ENOTFOUND ||
(!error && !git_oid_equal(&base, &spec->roid))) {
- giterr_set(GITERR_REFERENCE,
+ git_error_set(GIT_ERROR_REFERENCE,
"cannot push non-fastforwardable reference");
error = GIT_ENONFASTFORWARD;
goto on_error;
@@ -363,13 +363,13 @@ on_error:
static int add_update(git_push *push, push_spec *spec)
{
git_push_update *u = git__calloc(1, sizeof(git_push_update));
- GITERR_CHECK_ALLOC(u);
+ GIT_ERROR_CHECK_ALLOC(u);
u->src_refname = git__strdup(spec->refspec.src);
- GITERR_CHECK_ALLOC(u->src_refname);
+ GIT_ERROR_CHECK_ALLOC(u->src_refname);
u->dst_refname = git__strdup(spec->refspec.dst);
- GITERR_CHECK_ALLOC(u->dst_refname);
+ GIT_ERROR_CHECK_ALLOC(u->dst_refname);
git_oid_cpy(&u->src, &spec->roid);
git_oid_cpy(&u->dst, &spec->loid);
@@ -390,7 +390,7 @@ static int calculate_work(git_push *push)
/* This is a create or update. Local ref must exist. */
if (git_reference_name_to_id(
&spec->loid, push->repo, spec->refspec.src) < 0) {
- giterr_set(GITERR_REFERENCE, "no such reference '%s'", spec->refspec.src);
+ git_error_set(GIT_ERROR_REFERENCE, "no such reference '%s'", spec->refspec.src);
return -1;
}
}
@@ -416,7 +416,7 @@ static int do_push(git_push *push, const git_remote_callbacks *callbacks)
git_transport *transport = push->remote->transport;
if (!transport->push) {
- giterr_set(GITERR_NET, "remote transport doesn't support push");
+ git_error_set(GIT_ERROR_NET, "remote transport doesn't support push");
error = -1;
goto on_error;
}
@@ -485,7 +485,7 @@ int git_push_finish(git_push *push, const git_remote_callbacks *callbacks)
if (!push->unpack_ok) {
error = -1;
- giterr_set(GITERR_NET, "unpacking the sent packfile failed on the remote");
+ git_error_set(GIT_ERROR_NET, "unpacking the sent packfile failed on the remote");
}
return error;
@@ -501,7 +501,7 @@ int git_push_status_foreach(git_push *push,
git_vector_foreach(&push->status, i, status) {
int error = cb(status->ref, status->msg, data);
if (error)
- return giterr_set_after_callback(error);
+ return git_error_set_after_callback(error);
}
return 0;