remote: improved error reporting Several places in the remote code identify an error and then swallow it; return the error.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/src/fetch.c b/src/fetch.c
index dedbb54..bc5961d 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 a281dc9..9733eec 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 4bab948..f697e0f 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;