Commit f99a0d69 by Edward Thomson

remote: improved error reporting

Several places in the remote code identify an error and then swallow it;
return the error.
parent f5373123
......@@ -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++) {
......
......@@ -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) {
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment