Branch Coverage

deps/libgit2/src/libgit2/push.c
Criterion Covered Total %
branch 63 190 33.1


line true false branch
38 0 2 GIT_ERROR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
41 0 2 GIT_ERROR_CHECK_ALLOC(p);
46 2 0 p->pb_parallelism = opts ? opts->pb_parallelism : 1;
48 2 0 if (opts) {
49 0 2 GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
53 0 2 if (git_vector_init(&p->specs, 0, push_spec_rref_cmp) < 0) {
58 0 2 if (git_vector_init(&p->status, 0, push_status_ref_cmp) < 0) {
64 0 2 if (git_vector_init(&p->updates, 0, NULL) < 0) {
77 0 2 if (spec == NULL)
86 0 2 if (git__prefixcmp(ref, "refs/")) {
101 2 0 if (!error)
104 0 0 if (error == GIT_ENOTFOUND)
119 0 2 GIT_ERROR_CHECK_ALLOC(s);
121 0 2 if (git_refspec__parse(&s->refspec, str, false) < 0) {
126 2 0 if (s->refspec.src && s->refspec.src[0] != '\0' &&
131 0 2 if (check_rref(s->refspec.dst) < 0)
163 0 0 git_vector_foreach(&push->status, i, status) {
167 0 0 if (status->msg)
172 0 0 if (!fetch_spec)
178 0 0 if ((error = git_refspec__transform(&remote_ref_name, fetch_spec, status->ref)) < 0)
182 0 0 git_vector_foreach(&push->specs, j, push_spec) {
183 0 0 if (!strcmp(push_spec->refspec.dst, status->ref))
188 0 0 if (j == push->specs.length)
192 0 0 if (git_oid_is_zero(&push_spec->loid)) {
195 0 0 if (error >= 0) {
205 0 0 if (error < 0) {
206 0 0 if (error != GIT_ENOTFOUND)
213 0 0 if (fire_callback && callbacks && callbacks->update_tips) {
0 0 if (fire_callback && callbacks && callbacks->update_tips) {
0 0 if (fire_callback && callbacks && callbacks->update_tips) {
217 0 0 if (error < 0)
238 0 0 if ((error = git_object_lookup(&obj, push->repo, id, GIT_OBJECT_TAG)) < 0)
241 0 0 while (git_object_type(obj) == GIT_OBJECT_TAG) {
242 0 0 if ((error = git_packbuilder_insert(push->pb, git_object_id(obj), NULL)) < 0)
245 0 0 if ((error = git_tag_target(&target, (git_tag *) obj)) < 0)
252 0 0 if (error < 0)
268 0 2 if (git_revwalk_new(&rw, push->repo) < 0)
273 2 2 git_vector_foreach(&push->specs, i, spec) {
277 0 2 if (git_oid_is_zero(&spec->loid))
284 0 2 if (git_oid_equal(&spec->loid, &spec->roid))
287 0 2 if ((error = git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid)) < 0)
290 0 2 if (type == GIT_OBJECT_TAG) {
293 0 0 if ((error = enqueue_tag(&target, push, &spec->loid)) < 0)
296 0 0 if (git_object_type(target) == GIT_OBJECT_COMMIT) {
297 0 0 if ((error = git_revwalk_push(rw, git_object_id(target))) < 0) {
302 0 0 if ((error = git_packbuilder_insert(
309 0 2 } else if ((error = git_revwalk_push(rw, &spec->loid)) < 0)
312 2 0 if (!spec->refspec.force) {
315 2 0 if (git_oid_is_zero(&spec->roid))
318 0 0 if (!git_odb_exists(push->repo->_odb, &spec->roid)) {
328 0 0 if (error == GIT_ENOTFOUND ||
0 0 if (error == GIT_ENOTFOUND ||
329 0 0 (!error && !git_oid_equal(&base, &spec->roid))) {
336 0 0 if (error < 0)
341 0 2 git_vector_foreach(&push->remote->refs, i, head) {
342 0 0 if (git_oid_is_zero(&head->oid))
345 0 0 if ((error = git_revwalk_hide(rw, &head->oid)) < 0 &&
0 0 if ((error = git_revwalk_hide(rw, &head->oid)) < 0 &&
346 0 0 error != GIT_ENOTFOUND && error != GIT_EINVALIDSPEC && error != GIT_EPEEL)
0 0 error != GIT_ENOTFOUND && error != GIT_EINVALIDSPEC && error != GIT_EPEEL)
360 0 2 GIT_ERROR_CHECK_ALLOC(u);
363 0 2 GIT_ERROR_CHECK_ALLOC(u->src_refname);
366 0 2 GIT_ERROR_CHECK_ALLOC(u->dst_refname);
382 2 2 git_vector_foreach(&push->specs, i, spec) {
383 2 0 if (spec->refspec.src && spec->refspec.src[0]!= '\0') {
2 0 if (spec->refspec.src && spec->refspec.src[0]!= '\0') {
385 0 2 if (git_reference_name_to_id(
393 0 2 git_vector_foreach(&push->remote->refs, j, head) {
394 0 0 if (!strcmp(spec->refspec.dst, head->name)) {
400 0 2 if (add_update(push, spec) < 0)
413 0 2 if (!transport->push) {
425 0 2 if ((error = git_packbuilder_new(&push->pb, push->repo)) < 0)
430 2 0 if (callbacks && callbacks->pack_progress)
2 0 if (callbacks && callbacks->pack_progress)
431 0 2 if ((error = git_packbuilder_set_callbacks(push->pb, callbacks->pack_progress, callbacks->payload)) < 0)
434 0 2 if ((error = calculate_work(push)) < 0)
437 2 0 if (callbacks && callbacks->push_negotiation &&
0 2 if (callbacks && callbacks->push_negotiation &&
0 0 if (callbacks && callbacks->push_negotiation &&
442 2 0 if ((error = queue_objects(push)) < 0 ||
458 0 2 if (git_remote_ls(&heads, &heads_len, remote) < 0)
461 0 2 for (i = 0; i < heads_len; i++) {
462 0 0 if (git_vector_insert(&remote->refs, (void *)heads[i]) < 0)
473 0 2 if (!git_remote_connected(push->remote)) {
478 2 0 if ((error = filter_refs(push->remote)) < 0 ||
0 2 if ((error = filter_refs(push->remote)) < 0 ||
482 0 2 if (!push->unpack_ok) {
497 1 1 git_vector_foreach(&push->status, i, status) {
499 0 1 if (error)
508 0 2 if (status == NULL)
523 10 2 if (push == NULL)
526 2 2 git_vector_foreach(&push->specs, i, spec) {
531 2 2 git_vector_foreach(&push->status, i, status) {
536 2 2 git_vector_foreach(&push->updates, i, update) {
548 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(