Branch Coverage

deps/libgit2/src/libgit2/xdiff/xmerge.c
Criterion Covered Total %
branch 126 256 49.2


line true false branch
56 0 11 if (m && (i1 <= m->i1 + m->chg1 || i2 <= m->i2 + m->chg2)) {
0 0 if (m && (i1 <= m->i1 + m->chg1 || i2 <= m->i2 + m->chg2)) {
0 0 if (m && (i1 <= m->i1 + m->chg1 || i2 <= m->i2 + m->chg2)) {
57 0 0 if (mode != m->mode)
64 0 11 if (!m)
74 0 11 if (*merge)
87 11 11 for (; c; c = next_c) {
88 8 3 if (c->mode == 0)
103 9 0 for (i = 0; i < line_count; i++) {
106 9 0 if (!result)
117 0 82 recs = (use_orig ? xe->xdf1.recs : xe->xdf2.recs) + i;
119 40 42 if (count < 1)
122 46 42 for (i = 0; i < count; size += recs[i++]->size)
123 23 23 if (dest)
125 32 10 if (add_nl) {
127 32 0 if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') {
32 0 if (i == 0 || recs[count - 1]->ptr[i - 1] != '\n') {
128 0 32 if (needs_cr) {
129 0 0 if (dest)
134 16 16 if (dest)
161 4 48 if (i < file->nrec - 1)
163 4 0 return (size = file->recs[i]->size) > 1 &&
0 4 return (size = file->recs[i]->size) > 1 &&
165 0 48 if (!file->nrec)
168 48 0 if ((size = file->recs[i]->size) &&
0 48 if ((size = file->recs[i]->size) &&
171 0 0 return size > 1 &&
0 0 return size > 1 &&
173 48 0 if (!i)
177 0 0 return (size = file->recs[i - 1]->size) > 1 &&
0 0 return (size = file->recs[i - 1]->size) > 1 &&
186 4 16 needs_cr = is_eol_crlf(&xe1->xdf2, m->i1 ? m->i1 - 1 : 0);
187 16 4 if (needs_cr)
188 0 16 needs_cr = is_eol_crlf(&xe2->xdf2, m->i2 ? m->i2 - 1 : 0);
190 16 4 if (needs_cr)
202 16 0 int marker1_size = (name1 ? strlen(name1) + 1 : 0);
203 16 0 int marker2_size = (name2 ? strlen(name2) + 1 : 0);
204 16 0 int marker3_size = (name3 ? strlen(name3) + 1 : 0);
207 14 2 if (marker_size <= 0)
211 8 8 size += xdl_recs_copy(xe1, i, m->i1 - i, 0, 0,
214 8 8 if (!dest) {
219 8 0 if (marker1_size) {
224 0 8 if (needs_cr)
230 8 8 size += xdl_recs_copy(xe1, m->i1, m->chg1, needs_cr, 1,
233 16 0 if (style == XDL_MERGE_DIFF3 || style == XDL_MERGE_ZEALOUS_DIFF3) {
0 16 if (style == XDL_MERGE_DIFF3 || style == XDL_MERGE_ZEALOUS_DIFF3) {
235 0 0 if (!dest) {
240 0 0 if (marker3_size) {
245 0 0 if (needs_cr)
249 0 0 size += xdl_orig_copy(xe1, m->i0, m->chg0, needs_cr, 1,
253 8 8 if (!dest) {
258 0 8 if (needs_cr)
264 8 8 size += xdl_recs_copy(xe2, m->i2, m->chg2, needs_cr, 1,
266 8 8 if (!dest) {
271 8 0 if (marker2_size) {
276 0 8 if (needs_cr)
292 22 22 for (size = i = 0; m; m = m->next) {
293 6 16 if (favor && !m->mode)
3 3 if (favor && !m->mode)
296 16 6 if (m->mode == 0)
301 6 0 else if (m->mode & 3) {
303 3 3 size += xdl_recs_copy(xe1, i, m->i1 - i, 0, 0,
306 4 2 if (m->mode & 1) {
309 2 2 size += xdl_recs_copy(xe1, m->i1, m->chg1, needs_cr, (m->mode & 2),
313 2 4 if (m->mode & 2)
314 1 1 size += xdl_recs_copy(xe2, m->i2, m->chg2, 0, 0,
320 11 11 size += xdl_recs_copy(xe1, i, xe1->xdf2.nrec - i, 0, 0,
338 0 0 for (; m; m = m->next) {
340 0 0 if (m->mode)
343 0 0 while(m->chg1 && m->chg2 &&
350 0 0 while (m->chg1 && m->chg2 &&
366 11 11 for (; m; m = m->next) {
373 0 11 if (m->mode)
377 11 0 if (m->chg1 == 0 || m->chg2 == 0)
0 11 if (m->chg1 == 0 || m->chg2 == 0)
390 0 11 if (xdl_do_diff(&t1, &t2, xpp, &xe) < 0)
393 0 11 xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
398 0 11 if (!xscr) {
409 0 11 while (xscr->next) {
411 0 0 if (!m2) {
434 0 0 while (size--)
435 0 0 if (isalnum((unsigned char)*(ptr++)))
442 0 0 for (; chg; chg--, i++)
443 0 0 if (line_contains_alnum(xe->xdf2.recs[i]->ptr,
472 0 11 if (!m)
478 11 0 if (!next_m)
484 0 0 if (m->mode != 0 || next_m->mode != 0 ||
0 0 if (m->mode != 0 || next_m->mode != 0 ||
0 0 if (m->mode != 0 || next_m->mode != 0 ||
485 0 0 (end - begin > 3 &&
486 0 0 (!simplify_if_no_alnum ||
534 11 0 if (style == XDL_MERGE_DIFF3 || style == XDL_MERGE_ZEALOUS_DIFF3) {
0 11 if (style == XDL_MERGE_DIFF3 || style == XDL_MERGE_ZEALOUS_DIFF3) {
539 0 0 if (XDL_MERGE_EAGER < level)
545 11 11 while (xscr1 && xscr2) {
11 0 while (xscr1 && xscr2) {
546 11 0 if (!changes)
548 0 11 if (xscr1->i1 + xscr1->chg1 < xscr2->i1) {
555 0 0 if (xdl_append_merge(&c, 1,
563 0 11 if (xscr2->i1 + xscr2->chg1 < xscr1->i1) {
570 0 0 if (xdl_append_merge(&c, 2,
578 11 0 if (level == XDL_MERGE_MINIMAL || xscr1->i1 != xscr2->i1 ||
11 0 if (level == XDL_MERGE_MINIMAL || xscr1->i1 != xscr2->i1 ||
11 0 if (level == XDL_MERGE_MINIMAL || xscr1->i1 != xscr2->i1 ||
579 9 2 xscr1->chg1 != xscr2->chg1 ||
580 9 0 xscr1->chg2 != xscr2->chg2 ||
591 0 11 if (off > 0) {
600 0 11 if (ffo < 0) {
605 0 11 if (xdl_append_merge(&c, 0,
615 11 0 if (i1 >= i2)
617 11 0 if (i2 >= i1)
620 0 11 while (xscr1) {
621 0 0 if (!changes)
629 0 0 if (xdl_append_merge(&c, 1,
636 0 11 while (xscr2) {
637 0 0 if (!changes)
645 0 0 if (xdl_append_merge(&c, 2,
652 11 0 if (!changes)
655 0 11 if (style == XDL_MERGE_ZEALOUS_DIFF3) {
658 0 11 (xdl_refine_conflicts(xe1, xe2, changes, xpp) < 0 ||
665 11 0 if (result) {
672 0 11 if (!result->ptr) {
695 0 11 if (xdl_do_diff(orig, mf1, xpp, &xe1) < 0) {
698 0 11 if (xdl_do_diff(orig, mf2, xpp, &xe2) < 0) {
703 0 11 xdl_change_compact(&xe1.xdf2, &xe1.xdf1, xpp->flags) < 0 ||
709 0 11 xdl_change_compact(&xe2.xdf2, &xe2.xdf1, xpp->flags) < 0 ||
717 0 11 if (!xscr1) {
721 0 11 } else if (!xscr2) {