Branch Coverage

deps/libgit2/src/libgit2/xdiff/xdiffi.c
Criterion Covered Total %
branch 76 312 24.3


line true false branch
74 0 0 if (fmin > dmin)
78 0 0 if (fmax < dmax)
83 0 0 for (d = fmax; d >= fmin; d -= 2) {
84 0 0 if (kvdf[d - 1] >= kvdf[d + 1])
90 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++);
91 0 0 if (i1 - prev1 > xenv->snake_cnt)
94 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) {
111 0 0 if (bmin > dmin)
115 0 0 if (bmax < dmax)
120 0 0 for (d = bmax; d >= bmin; d -= 2) {
121 0 0 if (kvdb[d - 1] < kvdb[d + 1])
127 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--);
128 0 0 if (prev1 - i1 > xenv->snake_cnt)
131 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]) {
139 0 0 if (need_min)
152 0 0 if (got_snake && ec > xenv->heur_min) {
0 0 if (got_snake && ec > xenv->heur_min) {
153 0 0 for (best = 0, d = fmax; d >= fmin; d -= 2) {
154 0 0 dd = d > fmid ? d - fmid: fmid - d;
159 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 &&
160 0 0 off1 + xenv->snake_cnt <= i1 && i1 < lim1 &&
0 0 off1 + xenv->snake_cnt <= i1 && i1 < lim1 &&
161 0 0 off2 + xenv->snake_cnt <= i2 && i2 < lim2) {
162 0 0 for (k = 1; ha1[i1 - k] == ha2[i2 - k]; k++)
163 0 0 if (k == xenv->snake_cnt) {
171 0 0 if (best > 0) {
177 0 0 for (best = 0, d = bmax; d >= bmin; d -= 2) {
178 0 0 dd = d > bmid ? d - bmid: bmid - d;
183 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 &&
184 0 0 off1 < i1 && i1 <= lim1 - xenv->snake_cnt &&
0 0 off1 < i1 && i1 <= lim1 - xenv->snake_cnt &&
185 0 0 off2 < i2 && i2 <= lim2 - xenv->snake_cnt) {
186 0 0 for (k = 0; ha1[i1 + k] == ha2[i2 + k]; k++)
187 0 0 if (k == xenv->snake_cnt - 1) {
195 0 0 if (best > 0) {
207 0 0 if (ec >= xenv->mxcost) {
211 0 0 for (d = fmax; d >= fmin; d -= 2) {
214 0 0 if (lim2 < i2)
216 0 0 if (fbest < i1 + i2) {
223 0 0 for (d = bmax; d >= bmin; d -= 2) {
226 0 0 if (i2 < off2)
228 0 0 if (i1 + i2 < bbest) {
234 0 0 if ((lim1 + lim2) - bbest < fbest - (off1 + off2)) {
264 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++);
265 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--);
271 71 2 if (off1 == lim1) {
275 0 71 for (; off2 < lim2; off2++)
277 2 0 } else if (off2 == lim2) {
281 4 2 for (; off1 < lim1; off1++)
290 0 0 if (xdl_split(ha1, off1, lim1, ha2, off2, lim2, kvdf, kvdb,
299 0 0 if (xdl_recs_cmp(dd1, off1, spl.i1, dd2, off2, spl.i2,
300 0 0 kvdf, kvdb, spl.min_lo, xenv) < 0 ||
319 0 73 if (XDF_DIFF_ALG(xpp->flags) == XDF_PATIENCE_DIFF)
322 0 73 if (XDF_DIFF_ALG(xpp->flags) == XDF_HISTOGRAM_DIFF)
325 0 73 if (xdl_prepare_env(mf1, mf2, xpp, xe) < 0) {
337 0 73 if (!(kvd = (long *) xdl_malloc((2 * ndiags + 2) * sizeof(long)))) {
348 73 0 if (xenv.mxcost < XDL_MAX_COST_MIN)
362 0 73 if (xdl_recs_cmp(&dd1, 0, dd1.nrec, &dd2, 0, dd2.nrec,
379 0 75 if (!(xch = (xdchange_t *) xdl_malloc(sizeof(xdchange_t))))
416 0 0 for (i = 0; i < rec->size; i++) {
419 0 0 if (!XDL_ISSPACE(c))
421 0 0 else if (c == ' ')
423 0 0 else if (c == '\t')
427 0 0 if (ret >= MAX_INDENT)
494 0 0 if (split >= xdf->nrec) {
504 0 0 for (i = split - 1; i >= 0; i--) {
506 0 0 if (m->pre_indent != -1)
509 0 0 if (m->pre_blank == MAX_BLANKS) {
517 0 0 for (i = split + 1; i < xdf->nrec; i++) {
519 0 0 if (m->post_indent != -1)
522 0 0 if (m->post_blank == MAX_BLANKS) {
604 0 0 if (m->pre_indent == -1 && m->pre_blank == 0)
0 0 if (m->pre_indent == -1 && m->pre_blank == 0)
607 0 0 if (m->end_of_file)
614 0 0 post_blank = (m->indent == -1) ? 1 + m->post_blank : 0;
621 0 0 if (m->indent != -1)
631 0 0 if (indent == -1) {
633 0 0 } else if (m->pre_indent == -1) {
635 0 0 } else if (indent > m->pre_indent) {
640 0 0 RELATIVE_INDENT_WITH_BLANK_PENALTY :
642 0 0 } else if (indent == m->pre_indent) {
655 0 0 if (m->post_indent != -1 && m->post_indent > indent) {
0 0 if (m->post_indent != -1 && m->post_indent > indent) {
661 0 0 RELATIVE_OUTDENT_WITH_BLANK_PENALTY :
668 0 0 RELATIVE_DEDENT_WITH_BLANK_PENALTY :
718 224 292 while (xdf->rchg[g->end])
728 292 74 if (g->end == xdf->nrec)
732 37 74 for (g->end = g->start; xdf->rchg[g->end]; g->end++)
744 0 6 if (g->start == 0)
748 3 6 for (g->start = g->end; xdf->rchg[g->start - 1]; g->start--)
766 0 6 while (xdf->rchg[g->end])
787 0 6 while (xdf->rchg[g->start - 1])
813 61 119 if (g.end == g.start)
833 4 119 while (!group_slide_up(xdf, &g))
843 87 32 if (go.end > go.start)
848 119 6 if (group_slide_down(xdf, &g))
853 3 3 if (go.end > go.start)
856 0 119 } while (groupsize != g.end - g.start);
866 2 117 if (g.end == earliest_end) {
868 2 0 } else if (end_matching_other != -1) {
874 2 2 while (go.end == go.start) {
880 0 0 } else if (flags & XDF_INDENT_HEURISTIC) {
897 0 0 if (g.end - groupsize - 1 > shift)
899 0 0 if (g.end - INDENT_HEURISTIC_MAX_SLIDING > shift)
901 0 0 for (; shift <= g.end; shift++) {
917 0 0 while (g.end > best_shift) {
927 146 34 if (group_next(xdf, &g))
948 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--)
949 43 47 if (rchg1[i1 - 1] || rchg2[i2 - 1]) {
28 15 if (rchg1[i1 - 1] || rchg2[i2 - 1]) {
950 49 75 for (l1 = i1; rchg1[i1 - 1]; i1--);
951 80 75 for (l2 = i2; rchg2[i2 - 1]; i2--);
953 0 75 if (!(xch = xdl_add_change(cscr, i1, i2, l1 - i1, l2 - i2))) {
969 75 73 while ((xch = xscr) != NULL) {
980 2 2 for (xch = xscr; xch; xch = xche->next) {
982 0 2 if (!xch)
984 0 2 if (xecfg->hunk_func(xch->i1, xche->i1 + xche->chg1 - xch->i1,
996 0 0 for (xch = xscr; xch; xch = xch->next) {
1002 0 0 for (i = 0; i < xch->chg1 && ignore; i++)
0 0 for (i = 0; i < xch->chg1 && ignore; i++)
1006 0 0 for (i = 0; i < xch->chg2 && ignore; i++)
0 0 for (i = 0; i < xch->chg2 && ignore; i++)
1017 0 0 for (i = 0; i < xpp->ignore_regex_nr; i++)
1018 0 0 if (!xdl_regexec_buf(xpp->ignore_regex[i], rec->ptr, rec->size, 1,
1030 0 0 for (xch = xscr; xch; xch = xch->next) {
1038 0 0 if (xch->ignore)
1042 0 0 for (i = 0; i < xch->chg1 && ignore; i++)
0 0 for (i = 0; i < xch->chg1 && ignore; i++)
1046 0 0 for (i = 0; i < xch->chg2 && ignore; i++)
0 0 for (i = 0; i < xch->chg2 && ignore; i++)
1057 2 38 emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
1059 0 40 if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {
1064 0 40 xdl_change_compact(&xe.xdf2, &xe.xdf1, xpp->flags) < 0 ||
1070 40 0 if (xscr) {
1071 0 40 if (xpp->flags & XDF_IGNORE_BLANK_LINES)
1074 0 40 if (xpp->ignore_regex)
1077 0 40 if (ef(&xe, xscr, ecb, xecfg) < 0) {