Branch Coverage

deps/libgit2/src/blame_git.c
Criterion Covered Total %
branch 114 200 57.0


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')
379 2 0 if (file_a.size > GIT_XDIFF_MAX_SIZE ||
0 2 if (file_a.size > GIT_XDIFF_MAX_SIZE ||
391 4 0 if (o->blob) {
406 0 2 if (!find_last_in_target(&last_in_target, blame, target))
412 0 2 if (diff_hunks(file_p, file_o, &d) < 0)
416 0 2 if (blame_chunk(blame, d.tlno, d.plno, last_in_target, target, parent) < 0)
451 0 3 if (0 != git_diff_tree_to_tree(&difflist, blame->repository, ptree, otree, &diffopts))
454 0 3 if (!git_diff_num_deltas(difflist)) {
464 0 3 if (0 != git_diff_tree_to_tree(&difflist, blame->repository, ptree, otree, &diffopts))
469 0 3 if (0 != git_diff_find_similar(difflist, &findopts))
473 3 3 for (i=0; i<(int)git_diff_num_deltas(difflist); i++) {
476 3 0 if (!git_vector_bsearch(NULL, &blame->paths, delta->new_file.path))
505 0 0 for (e=blame->ent; e; e=e->next) {
506 0 0 if (!same_suspect(e->suspect, origin))
525 0 3 if (!git_oid_cmp(git_commit_id(commit), &blame->options.oldest_commit))
528 0 3 else if (opt & GIT_BLAME_FIRST_PARENT && num_parents > 1)
0 0 else if (opt & GIT_BLAME_FIRST_PARENT && num_parents > 1)
532 0 3 if (!num_parents) {
535 3 0 } else if (num_parents < (int)ARRAY_SIZE(sg_buf))
539 0 0 GIT_ERROR_CHECK_ALLOC(sg_origin);
542 3 3 for (i=0; i
546 0 3 if (sg_origin[i])
549 0 3 if ((error = git_commit_parent(&p, origin->commit, i)) < 0)
553 1 2 if (!porigin) {
563 2 0 if (porigin->blob && origin->blob &&
569 0 2 for (j = same = 0; j
575 2 0 if (!same)
582 3 3 for (i=0; i
584 1 2 if (!porigin)
586 2 0 if (!origin->previous) {
591 0 2 if ((ret = pass_blame_to_parent(blame, origin, porigin)) != 0) {
592 0 0 if (ret < 0)
604 3 3 for (i=0; i
605 2 1 if (sg_origin[i])
607 0 3 if (sg_origin != sg_buf)
621 3 0 for (ent=blame->ent; ent && (next = ent->next); ent = next) {
2 1 for (ent=blame->ent; ent && (next = ent->next); ent = next) {
622 0 2 if (same_suspect(ent->suspect, next->suspect) &&
0 0 if (same_suspect(ent->suspect, next->suspect) &&
623 0 0 ent->guilty == next->guilty &&
628 0 0 if (ent->next)
647 7 3 for (ent = blame->ent; !suspect && ent; ent = ent->next)
6 1 for (ent = blame->ent; !suspect && ent; ent = ent->next)
648 3 3 if (!ent->guilty)
650 1 3 if (!suspect)
656 0 3 if ((error = pass_blame(blame, suspect, opt)) < 0)
660 8 3 for (ent = blame->ent; ent; ent = ent->next) {
661 3 5 if (same_suspect(ent->suspect, suspect)) {
671 1 0 if (!error)
679 0 3 if (!ent) return;