Skip to content

Commit f99a0d6

Browse files
committed
remote: improved error reporting
Several places in the remote code identify an error and then swallow it; return the error.
1 parent f537312 commit f99a0d6

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/fetch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
8787
goto cleanup;
8888
}
8989

90-
if (git_repository_odb__weakptr(&odb, remote->repo) < 0)
90+
if ((error = git_repository_odb__weakptr(&odb, remote->repo)) < 0)
9191
goto cleanup;
9292

93-
if (git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote) < 0)
93+
if ((error = git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote)) < 0)
9494
goto cleanup;
9595

9696
for (i = 0; i < heads_len; i++) {

src/push.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ static int queue_objects(git_push *push)
291291
if (git_oid_equal(&spec->loid, &spec->roid))
292292
continue; /* up-to-date */
293293

294-
if (git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid) < 0)
294+
if ((error = git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid)) < 0)
295295
goto on_error;
296296

297297
if (type == GIT_OBJECT_TAG) {
@@ -301,19 +301,19 @@ static int queue_objects(git_push *push)
301301
goto on_error;
302302

303303
if (git_object_type(target) == GIT_OBJECT_COMMIT) {
304-
if (git_revwalk_push(rw, git_object_id(target)) < 0) {
304+
if ((error = git_revwalk_push(rw, git_object_id(target))) < 0) {
305305
git_object_free(target);
306306
goto on_error;
307307
}
308308
} else {
309-
if (git_packbuilder_insert(
310-
push->pb, git_object_id(target), NULL) < 0) {
309+
if ((error = git_packbuilder_insert(
310+
push->pb, git_object_id(target), NULL)) < 0) {
311311
git_object_free(target);
312312
goto on_error;
313313
}
314314
}
315315
git_object_free(target);
316-
} else if (git_revwalk_push(rw, &spec->loid) < 0)
316+
} else if ((error = git_revwalk_push(rw, &spec->loid)) < 0)
317317
goto on_error;
318318

319319
if (!spec->refspec.force) {

src/remote.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
10881088
if (ls_to_vector(&refs, remote) < 0)
10891089
return -1;
10901090

1091-
if ((git_vector_init(&specs, 0, NULL)) < 0)
1091+
if ((error = git_vector_init(&specs, 0, NULL)) < 0)
10921092
goto on_error;
10931093

10941094
remote->passed_refspecs = 0;

0 commit comments

Comments
 (0)