Branch Coverage

deps/libgit2/src/libgit2/blame_git.c
Criterion Covered Total %
branch 115 202 56.9


line true false branch
21 13 0 if (o)
28 16 2 if (o && --o->refcnt <= 0) {
3 13 if (o && --o->refcnt <= 0) {
29 2 1 if (o->previous)
45 1 3 if ((error = git_object_lookup_bypath(&blob, (git_object*)commit,
49 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*o), path_len);
50 0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
0 3 GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
52 0 3 GIT_ERROR_CHECK_ALLOC(o);
73 0 1 for (e = blame->ent; e; e = e->next) {
74 0 0 if (e->suspect->commit == commit && !strcmp(e->suspect->path, path)) {
0 0 if (e->suspect->commit == commit && !strcmp(e->suspect->path, path)) {
91 11 9 if (a == b)
93 9 0 if (git_oid_cmp(git_commit_id(a->commit), git_commit_id(b->commit)))
107 3 2 for (e=blame->ent; e; e=e->next) {
108 2 1 if (e->guilty || !same_suspect(e->suspect, target))
0 2 if (e->guilty || !same_suspect(e->suspect, target))
110 2 0 if (last_in_target < e->s_lno + e->num_lines) {
139 0 2 if (e->s_lno < tlno) {
152 2 0 if (same < e->s_lno + e->num_lines) {
168 0 2 if (split[1].num_lines < 1)
183 3 1 for (ent = blame->ent; ent && ent->lno < e->lno; ent = ent->next)
2 1 for (ent = blame->ent; ent && ent->lno < e->lno; ent = ent->next)
188 2 0 if (prev) {
195 1 1 if (e->next)
226 0 2 if (split[0].suspect && split[2].suspect) {
0 0 if (split[0].suspect && split[2].suspect) {
232 0 0 GIT_ERROR_CHECK_ALLOC(new_entry);
238 0 0 GIT_ERROR_CHECK_ALLOC(new_entry);
241 2 0 } else if (!split[0].suspect && !split[2].suspect) {
0 2 } else if (!split[0].suspect && !split[2].suspect) {
247 0 2 } else if (split[0].suspect) {
251 0 0 GIT_ERROR_CHECK_ALLOC(new_entry);
258 0 2 GIT_ERROR_CHECK_ALLOC(new_entry);
273 6 2 for (i=0; i<3; i++)
292 2 0 if (split[1].suspect)
293 0 2 if (split_blame(blame, split, e) < 0)
315 10 4 for (e = blame->ent; e; e = e->next) {
316 8 2 if (e->guilty || !same_suspect(e->suspect, target))
2 6 if (e->guilty || !same_suspect(e->suspect, target))
318 2 4 if (same <= e->s_lno)
320 2 2 if (tlno < e->s_lno + e->num_lines) {
321 0 2 if (blame_overlap(blame, e, tlno, plno, same, parent) < 0)
336 0 2 if (blame_chunk(d->blame, d->tlno, d->plno, start_b, d->target, d->parent) < 0)
352 0 2 if (ctx)
355 0 2 while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) {
0 0 while (blk + trimmed <= smaller && !memcmp(ap - blk, bp - blk, blk)) {
361 0 2 while (recovered < trimmed)
362 0 0 if (ap[recovered++] == '\n')
374 0 2 if (options->flags & GIT_BLAME_IGNORE_WHITESPACE)
382 2 0 if (file_a.size > GIT_XDIFF_MAX_SIZE ||
0 2 if (file_a.size > GIT_XDIFF_MAX_SIZE ||
394 4 0 if (o->blob) {
409 0 2 if (!find_last_in_target(&last_in_target, blame, target))
415 0 2 if (diff_hunks(file_p, file_o, &d, &blame->options) < 0)
419 0 2 if (blame_chunk(blame, d.tlno, d.plno, last_in_target, target, parent) < 0)
454 0 3 if (0 != git_diff_tree_to_tree(&difflist, blame->repository, ptree, otree, &diffopts))
457 0 3 if (!git_diff_num_deltas(difflist)) {
467 0 3 if (0 != git_diff_tree_to_tree(&difflist, blame->repository, ptree, otree, &diffopts))
472 0 3 if (0 != git_diff_find_similar(difflist, &findopts))
476 3 3 for (i=0; i<(int)git_diff_num_deltas(difflist); i++) {
479 3 0 if (!git_vector_bsearch(NULL, &blame->paths, delta->new_file.path))
508 0 0 for (e=blame->ent; e; e=e->next) {
509 0 0 if (!same_suspect(e->suspect, origin))
528 0 3 if (!git_oid_cmp(git_commit_id(commit), &blame->options.oldest_commit))
531 0 3 else if (opt & GIT_BLAME_FIRST_PARENT && num_parents > 1)
0 0 else if (opt & GIT_BLAME_FIRST_PARENT && num_parents > 1)
535 0 3 if (!num_parents) {
538 3 0 } else if (num_parents < (int)ARRAY_SIZE(sg_buf))
542 0 0 GIT_ERROR_CHECK_ALLOC(sg_origin);
545 3 3 for (i=0; i
549 0 3 if (sg_origin[i])
552 0 3 if ((error = git_commit_parent(&p, origin->commit, i)) < 0)
556 1 2 if (!porigin) {
566 2 0 if (porigin->blob && origin->blob &&
572 0 2 for (j = same = 0; j
578 2 0 if (!same)
585 3 3 for (i=0; i
587 1 2 if (!porigin)
589 2 0 if (!origin->previous) {
594 0 2 if ((ret = pass_blame_to_parent(blame, origin, porigin)) != 0) {
595 0 0 if (ret < 0)
607 3 3 for (i=0; i
608 2 1 if (sg_origin[i])
610 0 3 if (sg_origin != sg_buf)
624 3 0 for (ent=blame->ent; ent && (next = ent->next); ent = next) {
2 1 for (ent=blame->ent; ent && (next = ent->next); ent = next) {
625 0 2 if (same_suspect(ent->suspect, next->suspect) &&
0 0 if (same_suspect(ent->suspect, next->suspect) &&
626 0 0 ent->guilty == next->guilty &&
631 0 0 if (ent->next)
650 7 3 for (ent = blame->ent; !suspect && ent; ent = ent->next)
6 1 for (ent = blame->ent; !suspect && ent; ent = ent->next)
651 3 3 if (!ent->guilty)
653 1 3 if (!suspect)
659 0 3 if ((error = pass_blame(blame, suspect, opt)) < 0)
663 8 3 for (ent = blame->ent; ent; ent = ent->next) {
664 3 5 if (same_suspect(ent->suspect, suspect)) {
674 1 0 if (!error)
682 0 3 if (!ent) return;