summaryrefslogtreecommitdiff
path: root/src/push.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2020-02-07 11:57:48 +0100
committerPatrick Steinhardt <ps@pks.im>2020-02-07 13:04:02 +0100
commit6eebfc06989c42132f58b9f0b40283b067dd8613 (patch)
tree45eddfaa8617c50be3d89095e6fe76e251c2d037 /src/push.c
parent31a577d066f8b56901dc84d2addef97280463ac9 (diff)
downloadlibgit2-6eebfc06989c42132f58b9f0b40283b067dd8613.tar.gz
push: check error code returned by `git_revwalk_hide`
When queueing objects we want to push, we call `git_revwalk_hide` to hide all objects already known to the remote from our revwalk. We do not check its return value though, where the orginial intent was to ignore the case where the pushed OID is not a known committish. As `git_revwalk_hide` can fail due to other reasons like out-of-memory exceptions, we should still check its return value. Fix the issue by checking the function's return value, ignoring errors hinting that it's not a committish. As `git_revwalk__push_commit` currently clobbers these error codes, we need to adjust it as well in order to make it available downstream.
Diffstat (limited to 'src/push.c')
-rw-r--r--src/push.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/push.c b/src/push.c
index 67ebcfb3e..34867c2e4 100644
--- a/src/push.c
+++ b/src/push.c
@@ -349,8 +349,9 @@ static int queue_objects(git_push *push)
if (git_oid_is_zero(&head->oid))
continue;
- /* TODO */
- git_revwalk_hide(rw, &head->oid);
+ if ((error = git_revwalk_hide(rw, &head->oid)) < 0 &&
+ error != GIT_ENOTFOUND && error != GIT_EINVALIDSPEC && error != GIT_EPEEL)
+ goto on_error;
}
error = git_packbuilder_insert_walk(push->pb, rw);