Branch Coverage

deps/libgit2/src/xdiff/xdiffi.c
Criterion Covered Total %
branch 89 322 27.6


line true false branch
96 0 0 if (fmin > dmin)
100 0 0 if (fmax < dmax)
105 0 0 for (d = fmax; d >= fmin; d -= 2) {
106 0 0 if (kvdf[d - 1] >= kvdf[d + 1])
112 0 0 for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++);
0 0 for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++);
0 0 for (; i1 < lim1 && i2 < lim2 && ha1[i1] == ha2[i2]; i1++, i2++);
113 0 0 if (i1 - prev1 > xenv->snake_cnt)
116 0 0 if (odd && bmin <= d && d <= bmax && kvdb[d] <= i1) {
0 0 if (odd && bmin <= d && d <= bmax && kvdb[d] <= i1) {
0 0 if (odd && bmin <= d && d <= bmax && kvdb[d] <= i1) {
0 0 if (odd && bmin <= d && d <= bmax && kvdb[d] <= i1) {
131 0 0 if (bmin > dmin)
135 0 0 if (bmax < dmax)
140 0 0 for (d = bmax; d >= bmin; d -= 2) {
141 0 0 if (kvdb[d - 1] < kvdb[d + 1])
147 0 0 for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--);
0 0 for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--);
0 0 for (; i1 > off1 && i2 > off2 && ha1[i1 - 1] == ha2[i2 - 1]; i1--, i2--);
148 0 0 if (prev1 - i1 > xenv->snake_cnt)
151 0 0 if (!odd && fmin <= d && d <= fmax && i1 <= kvdf[d]) {
0 0 if (!odd && fmin <= d && d <= fmax && i1 <= kvdf[d]) {
0 0 if (!odd && fmin <= d && d <= fmax && i1 <= kvdf[d]) {
0 0 if (!odd && fmin <= d && d <= fmax && i1 <= kvdf[d]) {
159 0 0 if (need_min)
172 0 0 if (got_snake && ec > xenv->heur_min) {
0 0 if (got_snake && ec > xenv->heur_min) {
173 0 0 for (best = 0, d = fmax; d >= fmin; d -= 2) {
174 0 0 dd = d > fmid ? d - fmid: fmid - d;
179 0 0 if (v > XDL_K_HEUR * ec && v > best &&
0 0 if (v > XDL_K_HEUR * ec && v > best &&
0 0 if (v > XDL_K_HEUR * ec && v > best &&
180 0 0 off1 + xenv->snake_cnt <= i1 && i1 < lim1 &&
0 0 off1 + xenv->snake_cnt <= i1 && i1 < lim1 &&
181 0 0 off2 + xenv->snake_cnt <= i2 && i2 < lim2) {
182 0 0 for (k = 1; ha1[i1 - k] == ha2[i2 - k]; k++)
183 0 0 if (k == xenv->snake_cnt) {
191 0 0 if (best > 0) {
197 0 0 for (best = 0, d = bmax; d >= bmin; d -= 2) {
198 0 0 dd = d > bmid ? d - bmid: bmid - d;
203 0 0 if (v > XDL_K_HEUR * ec && v > best &&
0 0 if (v > XDL_K_HEUR * ec && v > best &&
0 0 if (v > XDL_K_HEUR * ec && v > best &&
204 0 0 off1 < i1 && i1 <= lim1 - xenv->snake_cnt &&
0 0 off1 < i1 && i1 <= lim1 - xenv->snake_cnt &&
205 0 0 off2 < i2 && i2 <= lim2 - xenv->snake_cnt) {
206 0 0 for (k = 0; ha1[i1 + k] == ha2[i2 + k]; k++)
207 0 0 if (k == xenv->snake_cnt - 1) {
215 0 0 if (best > 0) {
226 0 0 if (ec >= xenv->mxcost) {
230 0 0 for (d = fmax; d >= fmin; d -= 2) {
233 0 0 if (lim2 < i2)
235 0 0 if (fbest < i1 + i2) {
242 0 0 for (d = bmax; d >= bmin; d -= 2) {
245 0 0 if (i2 < off2)
247 0 0 if (i1 + i2 < bbest) {
253 0 0 if ((lim1 + lim2) - bbest < fbest - (off1 + off2)) {
283 4 71 for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++);
2 2 for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++);
2 0 for (; off1 < lim1 && off2 < lim2 && ha1[off1] == ha2[off2]; off1++, off2++);
284 2 71 for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--);
0 2 for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--);
0 0 for (; off1 < lim1 && off2 < lim2 && ha1[lim1 - 1] == ha2[lim2 - 1]; lim1--, lim2--);
290 71 2 if (off1 == lim1) {
294 0 71 for (; off2 < lim2; off2++)
296 2 0 } else if (off2 == lim2) {
300 4 2 for (; off1 < lim1; off1++)
309 0 0 if (xdl_split(ha1, off1, lim1, ha2, off2, lim2, kvdf, kvdb,
318 0 0 if (xdl_recs_cmp(dd1, off1, spl.i1, dd2, off2, spl.i2,
319 0 0 kvdf, kvdb, spl.min_lo, xenv) < 0 ||
338 0 73 if (XDF_DIFF_ALG(xpp->flags) == XDF_PATIENCE_DIFF)
341 0 73 if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF)
344 0 73 if (xdl_prepare_env(mf1, mf2, xpp, xe) < 0) {
353 0 73 GIT_ERROR_CHECK_ALLOC_ADD3(&ndiags, xe->xdf1.nreff, xe->xdf2.nreff, 3);
0 73 GIT_ERROR_CHECK_ALLOC_ADD3(&ndiags, xe->xdf1.nreff, xe->xdf2.nreff, 3);
354 0 73 GIT_ERROR_CHECK_ALLOC_MULTIPLY(&allocsize, ndiags, 2);
0 73 GIT_ERROR_CHECK_ALLOC_MULTIPLY(&allocsize, ndiags, 2);
355 0 73 GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, allocsize, 2);
0 73 GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, allocsize, 2);
356 0 73 GIT_ERROR_CHECK_ALLOC_MULTIPLY(&allocsize, allocsize, sizeof(long));
0 73 GIT_ERROR_CHECK_ALLOC_MULTIPLY(&allocsize, allocsize, sizeof(long));
358 0 73 if (!(kvd = (long *) xdl_malloc(allocsize))) {
368 73 0 if (xenv.mxcost < XDL_MAX_COST_MIN)
382 0 73 if (xdl_recs_cmp(&dd1, 0, dd1.nrec, &dd2, 0, dd2.nrec,
399 0 75 if (!(xch = (xdchange_t *) xdl_malloc(sizeof(xdchange_t))))
439 0 0 for (i = 0; i < rec->size; i++) {
442 0 0 if (!XDL_ISSPACE(c))
444 0 0 else if (c == ' ')
446 0 0 else if (c == '\t')
450 0 0 if (ret >= MAX_INDENT)
517 0 0 if (split >= xdf->nrec) {
527 0 0 for (i = split - 1; i >= 0; i--) {
529 0 0 if (m->pre_indent != -1)
532 0 0 if (m->pre_blank == MAX_BLANKS) {
540 0 0 for (i = split + 1; i < xdf->nrec; i++) {
542 0 0 if (m->post_indent != -1)
545 0 0 if (m->post_blank == MAX_BLANKS) {
622 0 0 if (m->pre_indent == -1 && m->pre_blank == 0)
0 0 if (m->pre_indent == -1 && m->pre_blank == 0)
625 0 0 if (m->end_of_file)
632 0 0 post_blank = (m->indent == -1) ? 1 + m->post_blank : 0;
639 0 0 if (m->indent != -1)
649 0 0 if (indent == -1) {
651 0 0 } else if (m->pre_indent == -1) {
653 0 0 } else if (indent > m->pre_indent) {
658 0 0 RELATIVE_INDENT_WITH_BLANK_PENALTY :
660 0 0 } else if (indent == m->pre_indent) {
673 0 0 if (m->post_indent != -1 && m->post_indent > indent) {
0 0 if (m->post_indent != -1 && m->post_indent > indent) {
679 0 0 RELATIVE_OUTDENT_WITH_BLANK_PENALTY :
686 0 0 RELATIVE_DEDENT_WITH_BLANK_PENALTY :
736 224 292 while (xdf->rchg[g->end])
746 292 74 if (g->end == xdf->nrec)
750 37 74 for (g->end = g->start; xdf->rchg[g->end]; g->end++)
762 0 6 if (g->start == 0)
766 3 6 for (g->start = g->end; xdf->rchg[g->start - 1]; g->start--)
784 0 6 while (xdf->rchg[g->end])
805 0 6 while (xdf->rchg[g->start - 1])
835 61 119 if (g.end == g.start)
854 4 119 while (!group_slide_up(xdf, &g, flags))
855 0 4 if (group_previous(xdfo, &go))
864 87 32 if (go.end > go.start)
869 119 6 if (group_slide_down(xdf, &g, flags))
871 0 6 if (group_next(xdfo, &go))
874 3 3 if (go.end > go.start)
877 0 119 } while (groupsize != g.end - g.start);
887 2 117 if (g.end == earliest_end) {
889 2 0 } else if (end_matching_other != -1) {
895 2 2 while (go.end == go.start) {
896 0 2 if (group_slide_up(xdf, &g, flags))
898 0 2 if (group_previous(xdfo, &go))
901 0 0 } else if (flags & XDF_INDENT_HEURISTIC) {
916 0 0 for (shift = earliest_end; shift <= g.end; shift++) {
932 0 0 while (g.end > best_shift) {
933 0 0 if (group_slide_up(xdf, &g, flags))
935 0 0 if (group_previous(xdfo, &go))
942 146 34 if (group_next(xdf, &g))
944 0 34 if (group_next(xdfo, &go))
948 0 146 if (!group_next(xdfo, &go))
963 90 73 for (i1 = xe->xdf1.nrec, i2 = xe->xdf2.nrec; i1 >= 0 || i2 >= 0; i1--, i2--)
0 73 for (i1 = xe->xdf1.nrec, i2 = xe->xdf2.nrec; i1 >= 0 || i2 >= 0; i1--, i2--)
964 43 47 if (rchg1[i1 - 1] || rchg2[i2 - 1]) {
28 15 if (rchg1[i1 - 1] || rchg2[i2 - 1]) {
965 49 75 for (l1 = i1; rchg1[i1 - 1]; i1--);
966 80 75 for (l2 = i2; rchg2[i2 - 1]; i2--);
968 0 75 if (!(xch = xdl_add_change(cscr, i1, i2, l1 - i1, l2 - i2))) {
984 75 73 while ((xch = xscr) != NULL) {
997 2 2 for (xch = xscr; xch; xch = xche->next) {
999 0 2 if (!xch)
1001 0 2 if (xecfg->hunk_func(xch->i1, xche->i1 + xche->chg1 - xch->i1,
1013 0 0 for (xch = xscr; xch; xch = xch->next) {
1019 0 0 for (i = 0; i < xch->chg1 && ignore; i++)
0 0 for (i = 0; i < xch->chg1 && ignore; i++)
1023 0 0 for (i = 0; i < xch->chg2 && ignore; i++)
0 0 for (i = 0; i < xch->chg2 && ignore; i++)
1034 2 38 emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
1036 0 40 if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
1041 0 40 xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
1047 40 0 if (xscr) {
1048 0 40 if (xpp->flags & XDF_IGNORE_BLANK_LINES)
1051 0 40 if (ef(&xe, xscr, ecb, xecfg) < 0) {