Branch Coverage

deps/libgit2/src/libgit2/transports/smart_protocol.c
Criterion Covered Total %
branch 0 388 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) {
67 0 0 if (gitno_consume(buf, line_end) < 0)
70 0 0 if (pkt->type == GIT_PKT_ERR) {
76 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)
79 0 0 if (pkt->type == GIT_PKT_FLUSH) {
83 0 0 } while (flush < flushes);
96 0 0 if (*ptr != '=')
100 0 0 if (!(end = strchr(ptr, ' ')) &&
0 0 if (!(end = strchr(ptr, ' ')) &&
104 0 0 if ((error = git_str_put(&buf, ptr, end - ptr)) < 0)
109 0 0 GIT_ERROR_CHECK_ALLOC(mapping);
115 0 0 if (error < 0) {
116 0 0 if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
123 0 0 if ((error = git_vector_insert(symrefs, mapping)) < 0)
141 0 0 if (pkt == NULL || pkt->capabilities == NULL)
0 0 if (pkt == NULL || pkt->capabilities == NULL)
145 0 0 while (ptr != NULL && *ptr != '\0') {
0 0 while (ptr != NULL && *ptr != '\0') {
146 0 0 if (*ptr == ' ')
149 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)) {
156 0 0 if (!git__prefixcmp(ptr, GIT_CAP_MULTI_ACK_DETAILED)) {
162 0 0 if (!git__prefixcmp(ptr, GIT_CAP_MULTI_ACK)) {
168 0 0 if (!git__prefixcmp(ptr, GIT_CAP_INCLUDE_TAG)) {
175 0 0 if (!git__prefixcmp(ptr, GIT_CAP_SIDE_BAND_64K)) {
181 0 0 if (!git__prefixcmp(ptr, GIT_CAP_SIDE_BAND)) {
187 0 0 if (!git__prefixcmp(ptr, GIT_CAP_DELETE_REFS)) {
193 0 0 if (!git__prefixcmp(ptr, GIT_CAP_THIN_PACK)) {
199 0 0 if (!git__prefixcmp(ptr, GIT_CAP_SYMREF)) {
202 0 0 if ((error = append_symref(&ptr, symrefs, ptr)) < 0)
208 0 0 if (!git__prefixcmp(ptr, GIT_CAP_WANT_TIP_SHA1)) {
214 0 0 if (!git__prefixcmp(ptr, GIT_CAP_WANT_REACHABLE_SHA1)) {
234 0 0 if (buf->offset > 0)
239 0 0 if (error == 0)
242 0 0 if (error < 0 && error != GIT_EBUFS)
0 0 if (error < 0 && error != GIT_EBUFS)
245 0 0 if ((ret = gitno_recv(buf)) < 0) {
247 0 0 } else if (ret == 0) {
251 0 0 } while (error);
253 0 0 if (gitno_consume(buf, line_end) < 0)
256 0 0 if (out_type != NULL)
258 0 0 if (out_pkt != NULL)
273 0 0 if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
276 0 0 if (pkt->type != GIT_PKT_ACK) {
281 0 0 if (git_vector_insert(&t->common, pkt) < 0) {
299 0 0 if ((error = recv_pkt(&pkt, NULL, buf)) < 0)
302 0 0 if (pkt->type == GIT_PKT_NAK)
304 0 0 if (pkt->type != GIT_PKT_ACK)
309 0 0 if (ack->status != GIT_ACK_CONTINUE &&
0 0 if (ack->status != GIT_ACK_CONTINUE &&
310 0 0 ack->status != GIT_ACK_COMMON &&
332 0 0 if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
335 0 0 if ((error = git_revwalk_new(&walk, repo)) < 0)
339 0 0 if ((error = git_revwalk__push_glob(walk, "refs/*", &opts)) < 0)
349 0 0 while (i < 256) {
352 0 0 if (error < 0) {
353 0 0 if (GIT_ITEROVER == error)
361 0 0 if (i % 20 == 0) {
362 0 0 if (t->cancelled.val) {
369 0 0 if (git_str_oom(&data)) {
374 0 0 if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
378 0 0 if (t->caps.multi_ack || t->caps.multi_ack_detailed) {
0 0 if (t->caps.multi_ack || t->caps.multi_ack_detailed) {
379 0 0 if ((error = store_common(t)) < 0)
382 0 0 if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
385 0 0 if (pkt_type == GIT_PKT_ACK) {
387 0 0 } else if (pkt_type == GIT_PKT_NAK) {
397 0 0 if (t->common.length > 0)
400 0 0 if (i % 20 == 0 && t->rpc) {
0 0 if (i % 20 == 0 && t->rpc) {
404 0 0 if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
407 0 0 git_vector_foreach(&t->common, j, pkt) {
408 0 0 if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0)
412 0 0 if (git_str_oom(&data)) {
420 0 0 if (t->rpc && t->common.length > 0) {
0 0 if (t->rpc && t->common.length > 0) {
424 0 0 if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
427 0 0 git_vector_foreach(&t->common, j, pkt) {
428 0 0 if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0)
432 0 0 if (git_str_oom(&data)) {
438 0 0 if ((error = git_pkt_buffer_done(&data)) < 0)
441 0 0 if (t->cancelled.val) {
446 0 0 if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
453 0 0 if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
0 0 if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
454 0 0 if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
457 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) {
478 0 0 if (t->cancelled.val) {
483 0 0 if (writepack->append(writepack, buf->data, buf->offset, stats) < 0)
488 0 0 if ((recvd = gitno_recv(buf)) < 0)
490 0 0 } while(recvd > 0);
492 0 0 if (writepack->commit(writepack, stats) < 0)
514 0 0 if ((npp->stats->received_bytes - npp->last_fired_bytes) > NETWORK_XFER_THRESHOLD) {
517 0 0 if (npp->callback(npp->stats, npp->payload))
541 0 0 if (progress_cb) {
549 0 0 if (t->buffer.offset > 0 && !t->cancelled.val)
0 0 if (t->buffer.offset > 0 && !t->cancelled.val)
550 0 0 if (t->packetsize_cb(t->buffer.offset, t->packetsize_payload))
554 0 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
0 0 if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
563 0 0 if (!t->caps.side_band && !t->caps.side_band_64k) {
0 0 if (!t->caps.side_band && !t->caps.side_band_64k) {
572 0 0 if (t->cancelled.val) {
578 0 0 if ((error = recv_pkt(&pkt, NULL, buf)) >= 0) {
580 0 0 if (t->cancelled.val) {
583 0 0 } else if (pkt->type == GIT_PKT_PROGRESS) {
584 0 0 if (t->connect_opts.callbacks.sideband_progress) {
587 0 0 if (p->len > INT_MAX) {
595 0 0 } else if (pkt->type == GIT_PKT_DATA) {
598 0 0 if (p->len)
600 0 0 } else if (pkt->type == GIT_PKT_FLUSH) {
609 0 0 if (error < 0)
623 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) {
625 0 0 if (error != 0)
632 0 0 if (writepack)
634 0 0 if (progress_cb) {
650 0 0 git_vector_foreach(&push->specs, i, spec) {
653 0 0 if (i == 0) {
655 0 0 if (push->report_status)
665 0 0 if (i == 0) {
668 0 0 if (push->report_status) {
680 0 0 return git_str_oom(buf) ? -1 : 0;
690 0 0 GIT_ERROR_CHECK_ALLOC(status);
701 0 0 GIT_ERROR_CHECK_ALLOC(status);
704 0 0 if (!status->ref || !status->msg ||
731 0 0 if (reading_from_buf) {
743 0 0 while (line_len > 0) {
746 0 0 if (error == GIT_EBUFS) {
749 0 0 if (!reading_from_buf)
754 0 0 else if (error < 0)
765 0 0 if (error < 0 && error != GIT_ITEROVER)
0 0 if (error < 0 && error != GIT_ITEROVER)
772 0 0 if (reading_from_buf)
786 0 0 if (buf->offset > 0)
792 0 0 if (error < 0 && error != GIT_EBUFS) {
0 0 if (error < 0 && error != GIT_EBUFS) {
797 0 0 if (error == GIT_EBUFS) {
798 0 0 if ((recvd = gitno_recv(buf)) < 0) {
803 0 0 if (recvd == 0) {
811 0 0 if (gitno_consume(buf, line_end) < 0)
827 0 0 if (transport->connect_opts.callbacks.sideband_progress) {
830 0 0 if (p->len > INT_MAX) {
847 0 0 if (error == GIT_ITEROVER) {
849 0 0 if (data_pkt_buf.size > 0) {
858 0 0 if (error < 0) {
870 0 0 GIT_ERROR_CHECK_ALLOC(added);
898 0 0 if (push_specs->length != push_report->length) {
908 0 0 git_vector_foreach(push_specs, i, push_spec) {
913 0 0 if (strcmp(push_spec->refspec.dst, push_status->ref)) {
925 0 0 while (i < push_specs->length && j < refs_len) {
0 0 while (i < push_specs->length && j < refs_len) {
933 0 0 if (cmp <= 0) i++;
934 0 0 if (cmp >= 0) j++;
937 0 0 if (cmp < 0 &&
0 0 if (cmp < 0 &&
938 0 0 !push_status->msg &&
943 0 0 if (cmp == 0 &&
0 0 if (cmp == 0 &&
948 0 0 for (; i < push_specs->length; i++) {
959 0 0 git_vector_rforeach(refs, i, ref) {
960 0 0 if (git_oid_is_zero(&ref->head.oid)) {
986 0 0 if ((error = payload->stream->write(payload->stream, (const char *)buf, size)) < 0)
989 0 0 if (payload->cb) {
994 0 0 if (elapsed < 0 || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
0 0 if (elapsed < 0 || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
1015 0 0 if (cbs && cbs->push_transfer_progress) {
0 0 if (cbs && cbs->push_transfer_progress) {
1044 0 0 git_vector_foreach(&push->specs, i, spec) {
1045 0 0 if (spec->refspec.src && spec->refspec.src[0] != '\0') {
0 0 if (spec->refspec.src && spec->refspec.src[0] != '\0') {
1052 0 0 if (need_pack && ((error = git_packbuilder__prepare(push->pb))) < 0)
0 0 if (need_pack && ((error = git_packbuilder__prepare(push->pb))) < 0)
1055 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 ||
1056 0 0 (error = gen_pktline(&pktline, push)) < 0 ||
1060 0 0 if (need_pack &&
0 0 if (need_pack &&
1066 0 0 if (!push->specs.length || !push->report_status)
0 0 if (!push->specs.length || !push->report_status)
1068 0 0 else if ((error = parse_report(t, push)) < 0)
1072 0 0 if (cbs && cbs->push_transfer_progress) {
0 0 if (cbs && cbs->push_transfer_progress) {
1079 0 0 if (error < 0)
1083 0 0 if (push->status.length) {
1085 0 0 if (error < 0)