Branch Coverage

deps/libgit2/src/libgit2/blame.c
Criterion Covered Total %
branch 80 152 52.6


line true false branch
31 2 8 if (lineno < final_start_line_number)
33 4 4 if (lineno >= final_start_line_number + lines_in_hunk)
44 0 6 if (a->final_start_line_number > b->final_start_line_number)
46 6 0 else if (a->final_start_line_number < b->final_start_line_number)
69 0 7 if (!hunk) return NULL;
74 7 0 hunk->orig_path = path ? git__strdup(path) : NULL;
95 0 3 if (!newhunk)
117 2 0 if (!git_vector_bsearch2(&i, v, hunk_byfinalline_search_cmp, &start_line)) {
118 4 2 for (; i < v->length; i++) {
131 0 2 if (!gbr)
138 2 0 git_vector_init(&gbr->paths, 8, paths_cmp) < 0 ||
139 0 2 (gbr->path = git__strdup(path)) == NULL ||
160 0 2 if (!blame) return;
162 7 2 git_vector_foreach(&blame->hunks, i, hunk)
179 0 7 GIT_ASSERT_ARG(blame);
185 0 7 GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
193 0 3 GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
195 2 1 if (!git_vector_bsearch2(&i, &blame->hunks, hunk_byfinalline_search_cmp, &new_lineno)) {
208 0 1 if (!in) in = &dummy;
213 1 0 if (git_oid_is_zero(&out->newest_commit)) {
214 0 1 if (git_reference_name_to_id(&out->newest_commit, repo, "HEAD") < 0) {
220 1 0 if (!out->min_line) out->min_line = 1;
224 0 1 if (out->flags & GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES)
226 0 1 if (out->flags & GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES)
228 0 1 if (out->flags & GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES)
244 0 0 if (rel_line <= 0 ||
0 0 if (rel_line <= 0 ||
254 0 0 if (!nh)
264 0 0 git_blame_hunk *ret = return_new ? nh : hunk;
281 1 0 if (len && buf[len-1] != '\n')
1 0 if (len && buf[len-1] != '\n')
283 25 1 while (len--) {
284 4 21 if (bol) {
285 1 3 i = git_array_alloc(blame->line_index);
1 0 i = git_array_alloc(blame->line_index);
286 0 4 GIT_ERROR_CHECK_ALLOC(i);
290 3 22 if (*buf++ == '\n') {
295 0 1 i = git_array_alloc(blame->line_index);
0 0 i = git_array_alloc(blame->line_index);
296 0 1 GIT_ERROR_CHECK_ALLOC(i);
307 0 3 if (!h)
323 1 1 if (blame->final_blob) return 0;
326 0 1 if (error < 0)
341 1 0 if ((error = load_blob(blame)) < 0 ||
1 0 if ((error = load_blob(blame)) < 0 ||
355 0 1 GIT_ERROR_CHECK_ALLOC(ent);
360 0 1 if (blame->options.max_line > 0)
370 3 1 for (ent = blame->ent; ent; ) {
397 0 1 GIT_ASSERT_ARG(out);
398 0 1 GIT_ASSERT_ARG(repo);
399 0 1 GIT_ASSERT_ARG(path);
401 0 1 if ((error = normalize_options(&normOptions, options, repo)) < 0)
405 0 1 GIT_ERROR_CHECK_ALLOC(blame);
407 0 1 if ((error = load_blob(blame)) < 0)
410 0 1 if ((error = blame_internal(blame)) < 0)
427 1 0 return hunk && git_oid_is_zero(&hunk->final_commit_id);
0 1 return hunk && git_oid_is_zero(&hunk->final_commit_id);
440 0 1 wedge_line = (hunk->old_lines == 0) ? hunk->new_start : hunk->old_start;
444 0 1 if (!blame->current_hunk) {
447 0 0 GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
450 0 1 } else if (!hunk_starts_at_or_after_line(blame->current_hunk, wedge_line)){
454 0 0 GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
460 0 0 static int ptrs_equal_cmp(const void *a, const void *b) { return ab ? 1 : 0; }
473 1 1 if (line->origin == GIT_DIFF_LINE_ADDITION) {
483 0 1 GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
490 1 1 if (line->origin == GIT_DIFF_LINE_DELETION) {
494 0 1 if (--(blame->current_hunk->lines_in_hunk) == 0) {
497 0 0 if (!git_vector_search2(&i, &blame->hunks, ptrs_equal_cmp, blame->current_hunk)) {
521 0 1 GIT_ASSERT_ARG(out);
522 0 1 GIT_ASSERT_ARG(reference);
523 1 0 GIT_ASSERT_ARG(buffer && buffer_len);
0 1 GIT_ASSERT_ARG(buffer && buffer_len);
526 0 1 GIT_ERROR_CHECK_ALLOC(blame);
529 3 1 git_vector_foreach(&reference->hunks, i, hunk) {
531 0 3 GIT_ERROR_CHECK_ALLOC(h);
547 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(