Branch Coverage

deps/libgit2/src/transports/smart_protocol.c
Criterion Covered Total %
branch 0 372 0.0


line true false branch
40 0 0 git_vector_foreach(refs, i, pkt) {
47 0 0 if (buf->offset > 0)
52 0 0 if (error < 0 && error != GIT_EBUFS)
0 0 if (error < 0 && error != GIT_EBUFS)
55 0 0 if (error == GIT_EBUFS) {
56 0 0 if ((recvd = gitno_recv(buf)) < 0)
59 0 0 if (recvd == 0) {
68 0 0 if (pkt->type == GIT_PKT_ERR) {
74 0 0 if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0)
0 0 if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0)
77 0 0 if (pkt->type == GIT_PKT_FLUSH) {
81 0 0 } while (flush < flushes);
94 0 0 if (*ptr != '=')
98 0 0 if (!(end = strchr(ptr, ' ')) &&
0 0 if (!(end = strchr(ptr, ' ')) &&
102 0 0 if ((error = git_buf_put(&buf, ptr, end - ptr)) < 0)
107 0 0 GIT_ERROR_CHECK_ALLOC(mapping);
113 0 0 if (error < 0) {
114 0 0 if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
121 0 0 if ((error = git_vector_insert(symrefs, mapping)) < 0)
139 0 0 if (pkt == NULL || pkt->capabilities == NULL)
0 0 if (pkt == NULL || pkt->capabilities == NULL)
143 0 0 while (ptr != NULL && *ptr != '\0') {
0 0 while (ptr != NULL && *ptr != '\0') {
144 0 0 if (*ptr == ' ')
147 0 0 if (git_smart__ofs_delta_enabled && !git__prefixcmp(ptr, GIT_CAP_OFS_DELTA)) {
0 0 if (git_smart__ofs_delta_enabled && !git__prefixcmp(ptr, GIT_CAP_OFS_DELTA)) {
154 0 0 if (!git__prefixcmp(ptr, GIT_CAP_MULTI_ACK_DETAILED)) {
160 0 0 if (!git__prefixcmp(ptr, GIT_CAP_MULTI_ACK)) {
166 0 0 if (!git__prefixcmp(ptr, GIT_CAP_INCLUDE_TAG)) {
173 0 0 if (!git__prefixcmp(ptr, GIT_CAP_SIDE_BAND_64K)) {
179 0 0 if (!git__prefixcmp(ptr, GIT_CAP_SIDE_BAND)) {
185 0 0 if (!git__prefixcmp(ptr, GIT_CAP_DELETE_REFS)) {
191 0 0 if (!git__prefixcmp(ptr, GIT_CAP_THIN_PACK)) {
197 0 0 if (!git__prefixcmp(ptr, GIT_CAP_SYMREF)) {
200 0 0 if ((error = append_symref(&ptr, symrefs, ptr)) < 0)
220 0 0 if (buf->offset > 0)
225 0 0 if (error == 0)
228 0 0 if (error < 0 && error != GIT_EBUFS)
0 0 if (error < 0 && error != GIT_EBUFS)
231 0 0 if ((ret = gitno_recv(buf)) < 0) {
233 0 0 } else if (ret == 0) {
237 0 0 } while (error);
240 0 0 if (out_type != NULL)
242 0 0 if (out_pkt != NULL)
257 0 0 if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
260 0 0 if (pkt->type != GIT_PKT_ACK) {
265 0 0 if (git_vector_insert(&t->common, pkt) < 0) {
283 0 0 if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
286 0 0 if (pkt->type == GIT_PKT_NAK)
288 0 0 if (pkt->type != GIT_PKT_ACK)
293 0 0 if (ack->status != GIT_ACK_CONTINUE &&
0 0 if (ack->status != GIT_ACK_CONTINUE &&
294 0 0 ack->status != GIT_ACK_COMMON &&
316 0 0 if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
319 0 0 if ((error = git_revwalk_new(&walk, repo)) < 0)
323 0 0 if ((error = git_revwalk__push_glob(walk, "refs/*", &opts)) < 0)
333 0 0 while (i < 256) {
336 0 0 if (error < 0) {
337 0 0 if (GIT_ITEROVER == error)
345 0 0 if (i % 20 == 0) {
346 0 0 if (t->cancelled.val) {
353 0 0 if (git_buf_oom(&data)) {
358 0 0 if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
362 0 0 if (t->caps.multi_ack || t->caps.multi_ack_detailed) {
0 0 if (t->caps.multi_ack || t->caps.multi_ack_detailed) {
363 0 0 if ((error = store_common(t)) < 0)
366 0 0 if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
369 0 0 if (pkt_type == GIT_PKT_ACK) {
371 0 0 } else if (pkt_type == GIT_PKT_NAK) {
381 0 0 if (t->common.length > 0)
384 0 0 if (i % 20 == 0 && t->rpc) {
0 0 if (i % 20 == 0 && t->rpc) {
388 0 0 if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
391 0 0 git_vector_foreach(&t->common, j, pkt) {
392 0 0 if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0)
396 0 0 if (git_buf_oom(&data)) {
404 0 0 if (t->rpc && t->common.length > 0) {
0 0 if (t->rpc && t->common.length > 0) {
408 0 0 if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
411 0 0 git_vector_foreach(&t->common, j, pkt) {
412 0 0 if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0)
416 0 0 if (git_buf_oom(&data)) {
422 0 0 if ((error = git_pkt_buffer_done(&data)) < 0)
425 0 0 if (t->cancelled.val) {
430 0 0 if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
437 0 0 if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
0 0 if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
438 0 0 if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
441 0 0 if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
0 0 if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
462 0 0 if (t->cancelled.val) {
467 0 0 if (writepack->append(writepack, buf->data, buf->offset, stats) < 0)
472 0 0 if ((recvd = gitno_recv(buf)) < 0)
474 0 0 } while(recvd > 0);
476 0 0 if (writepack->commit(writepack, stats) < 0)
498 0 0 if ((npp->stats->received_bytes - npp->last_fired_bytes) > NETWORK_XFER_THRESHOLD) {
501 0 0 if (npp->callback(npp->stats, npp->payload))
524 0 0 if (progress_cb) {
532 0 0 if (t->buffer.offset > 0 && !t->cancelled.val)
0 0 if (t->buffer.offset > 0 && !t->cancelled.val)
533 0 0 if (t->packetsize_cb(t->buffer.offset, t->packetsize_payload))
537 0 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
0 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
546 0 0 if (!t->caps.side_band && !t->caps.side_band_64k) {
0 0 if (!t->caps.side_band && !t->caps.side_band_64k) {
555 0 0 if (t->cancelled.val) {
561 0 0 if ((error = recv_pkt(&pkt, NULL, buf)) >= 0) {
563 0 0 if (t->cancelled.val) {
566 0 0 } else if (pkt->type == GIT_PKT_PROGRESS) {
567 0 0 if (t->progress_cb) {
570 0 0 if (p->len > INT_MAX) {
578 0 0 } else if (pkt->type == GIT_PKT_DATA) {
581 0 0 if (p->len)
583 0 0 } else if (pkt->type == GIT_PKT_FLUSH) {
592 0 0 if (error < 0)
606 0 0 if (npp.callback && npp.stats->received_bytes > npp.last_fired_bytes) {
0 0 if (npp.callback && npp.stats->received_bytes > npp.last_fired_bytes) {
608 0 0 if (error != 0)
615 0 0 if (writepack)
617 0 0 if (progress_cb) {
633 0 0 git_vector_foreach(&push->specs, i, spec) {
636 0 0 if (i == 0) {
638 0 0 if (push->report_status)
648 0 0 if (i == 0) {
651 0 0 if (push->report_status) {
663 0 0 return git_buf_oom(buf) ? -1 : 0;
673 0 0 GIT_ERROR_CHECK_ALLOC(status);
684 0 0 GIT_ERROR_CHECK_ALLOC(status);
687 0 0 if (!status->ref || !status->msg ||
714 0 0 if (reading_from_buf) {
726 0 0 while (line_len > 0) {
729 0 0 if (error == GIT_EBUFS) {
732 0 0 if (!reading_from_buf)
737 0 0 else if (error < 0)
748 0 0 if (error < 0 && error != GIT_ITEROVER)
0 0 if (error < 0 && error != GIT_ITEROVER)
755 0 0 if (reading_from_buf)
769 0 0 if (buf->offset > 0)
775 0 0 if (error < 0 && error != GIT_EBUFS) {
0 0 if (error < 0 && error != GIT_EBUFS) {
780 0 0 if (error == GIT_EBUFS) {
781 0 0 if ((recvd = gitno_recv(buf)) < 0) {
786 0 0 if (recvd == 0) {
809 0 0 if (transport->progress_cb) {
812 0 0 if (p->len > INT_MAX) {
829 0 0 if (error == GIT_ITEROVER) {
831 0 0 if (data_pkt_buf.size > 0) {
840 0 0 if (error < 0) {
852 0 0 GIT_ERROR_CHECK_ALLOC(added);
880 0 0 if (push_specs->length != push_report->length) {
890 0 0 git_vector_foreach(push_specs, i, push_spec) {
895 0 0 if (strcmp(push_spec->refspec.dst, push_status->ref)) {
907 0 0 while (i < push_specs->length && j < refs_len) {
0 0 while (i < push_specs->length && j < refs_len) {
915 0 0 if (cmp <= 0) i++;
916 0 0 if (cmp >= 0) j++;
919 0 0 if (cmp < 0 &&
0 0 if (cmp < 0 &&
920 0 0 !push_status->msg &&
925 0 0 if (cmp == 0 &&
0 0 if (cmp == 0 &&
930 0 0 for (; i < push_specs->length; i++) {
941 0 0 git_vector_rforeach(refs, i, ref) {
942 0 0 if (git_oid_is_zero(&ref->head.oid)) {
968 0 0 if ((error = payload->stream->write(payload->stream, (const char *)buf, size)) < 0)
971 0 0 if (payload->cb) {
975 0 0 if ((current_time - payload->last_progress_report_time) >= MIN_PROGRESS_UPDATE_INTERVAL) {
995 0 0 if (cbs && cbs->push_transfer_progress) {
0 0 if (cbs && cbs->push_transfer_progress) {
1024 0 0 git_vector_foreach(&push->specs, i, spec) {
1025 0 0 if (spec->refspec.src && spec->refspec.src[0] != '\0') {
0 0 if (spec->refspec.src && spec->refspec.src[0] != '\0') {
1031 0 0 if ((error = git_smart__get_push_stream(t, &packbuilder_payload.stream)) < 0 ||
0 0 if ((error = git_smart__get_push_stream(t, &packbuilder_payload.stream)) < 0 ||
1032 0 0 (error = gen_pktline(&pktline, push)) < 0 ||
1036 0 0 if (need_pack &&
0 0 if (need_pack &&
1042 0 0 if (!push->specs.length || !push->report_status)
0 0 if (!push->specs.length || !push->report_status)
1044 0 0 else if ((error = parse_report(t, push)) < 0)
1048 0 0 if (cbs && cbs->push_transfer_progress) {
0 0 if (cbs && cbs->push_transfer_progress) {
1055 0 0 if (error < 0)
1059 0 0 if (push->status.length) {
1061 0 0 if (error < 0)