summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2022-01-04 15:17:01 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-06 15:18:32 -0500
commitf99a0d695c0a1a8e44fc1e5216d481ff016ec65d (patch)
tree6b6c56fc974f90af3f08edb068dcf62cbad0c43e
parentf5373123d2c20d2986fdee20d821816ce07819aa (diff)
downloadlibgit2-f99a0d695c0a1a8e44fc1e5216d481ff016ec65d.tar.gz
remote: improved error reporting
Several places in the remote code identify an error and then swallow it; return the error.
-rw-r--r--src/fetch.c4
-rw-r--r--src/push.c10
-rw-r--r--src/remote.c2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/fetch.c b/src/fetch.c
index dedbb54fa..bc5961db4 100644
--- a/src/fetch.c
+++ b/src/fetch.c
@@ -87,10 +87,10 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
goto cleanup;
}
- if (git_repository_odb__weakptr(&odb, remote->repo) < 0)
+ if ((error = git_repository_odb__weakptr(&odb, remote->repo)) < 0)
goto cleanup;
- if (git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote) < 0)
+ if ((error = git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote)) < 0)
goto cleanup;
for (i = 0; i < heads_len; i++) {
diff --git a/src/push.c b/src/push.c
index a281dc979..9733eecf9 100644
--- a/src/push.c
+++ b/src/push.c
@@ -291,7 +291,7 @@ static int queue_objects(git_push *push)
if (git_oid_equal(&spec->loid, &spec->roid))
continue; /* up-to-date */
- if (git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid) < 0)
+ if ((error = git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid)) < 0)
goto on_error;
if (type == GIT_OBJECT_TAG) {
@@ -301,19 +301,19 @@ static int queue_objects(git_push *push)
goto on_error;
if (git_object_type(target) == GIT_OBJECT_COMMIT) {
- if (git_revwalk_push(rw, git_object_id(target)) < 0) {
+ if ((error = git_revwalk_push(rw, git_object_id(target))) < 0) {
git_object_free(target);
goto on_error;
}
} else {
- if (git_packbuilder_insert(
- push->pb, git_object_id(target), NULL) < 0) {
+ if ((error = git_packbuilder_insert(
+ push->pb, git_object_id(target), NULL)) < 0) {
git_object_free(target);
goto on_error;
}
}
git_object_free(target);
- } else if (git_revwalk_push(rw, &spec->loid) < 0)
+ } else if ((error = git_revwalk_push(rw, &spec->loid)) < 0)
goto on_error;
if (!spec->refspec.force) {
diff --git a/src/remote.c b/src/remote.c
index 4bab9482d..f697e0fb8 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -1088,7 +1088,7 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
if (ls_to_vector(&refs, remote) < 0)
return -1;
- if ((git_vector_init(&specs, 0, NULL)) < 0)
+ if ((error = git_vector_init(&specs, 0, NULL)) < 0)
goto on_error;
remote->passed_refspecs = 0;