Branch Coverage

deps/libgit2/src/blame.c
Criterion Covered Total %
branch 81 152 53.2


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;
87 0 3 if (!newhunk)
112 2 0 if (!git_vector_bsearch2(&i, v, hunk_byfinalline_search_cmp, &start_line)) {
113 4 2 for (; i < v->length; i++) {
126 0 2 if (!gbr)
133 2 0 git_vector_init(&gbr->paths, 8, paths_cmp) < 0 ||
134 0 2 (gbr->path = git__strdup(path)) == NULL ||
155 0 2 if (!blame) return;
157 7 2 git_vector_foreach(&blame->hunks, i, hunk)
174 0 7 assert(blame);
180 0 7 assert(blame);
187 0 3 assert(blame);
189 2 1 if (!git_vector_bsearch2(&i, &blame->hunks, hunk_byfinalline_search_cmp, &new_lineno)) {
202 0 1 if (!in) in = &dummy;
207 1 0 if (git_oid_is_zero(&out->newest_commit)) {
208 0 1 if (git_reference_name_to_id(&out->newest_commit, repo, "HEAD") < 0) {
214 1 0 if (!out->min_line) out->min_line = 1;
218 0 1 if (out->flags & GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES)
220 0 1 if (out->flags & GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES)
222 0 1 if (out->flags & GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES)
238 0 0 if (rel_line <= 0 ||
0 0 if (rel_line <= 0 ||
248 0 0 if (!nh)
258 0 0 git_blame_hunk *ret = return_new ? nh : hunk;
275 1 0 if (len && buf[len-1] != '\n')
1 0 if (len && buf[len-1] != '\n')
277 25 1 while (len--) {
278 4 21 if (bol) {
279 1 3 i = git_array_alloc(blame->line_index);
3 0 i = git_array_alloc(blame->line_index);
280 0 4 GIT_ERROR_CHECK_ALLOC(i);
284 3 22 if (*buf++ == '\n') {
289 0 1 i = git_array_alloc(blame->line_index);
1 0 i = git_array_alloc(blame->line_index);
290 0 1 GIT_ERROR_CHECK_ALLOC(i);
301 0 3 if (!h)
317 1 1 if (blame->final_blob) return 0;
320 0 1 if (error < 0)
335 1 0 if ((error = load_blob(blame)) < 0 ||
1 0 if ((error = load_blob(blame)) < 0 ||
349 0 1 GIT_ERROR_CHECK_ALLOC(ent);
354 0 1 if (blame->options.max_line > 0)
364 3 1 for (ent = blame->ent; ent; ) {
391 1 0 assert(out && repo && path);
1 0 assert(out && repo && path);
0 1 assert(out && repo && path);
392 0 1 if ((error = normalize_options(&normOptions, options, repo)) < 0)
396 0 1 GIT_ERROR_CHECK_ALLOC(blame);
398 0 1 if ((error = load_blob(blame)) < 0)
401 0 1 if ((error = blame_internal(blame)) < 0)
418 1 0 return hunk && git_oid_is_zero(&hunk->final_commit_id);
0 1 return hunk && git_oid_is_zero(&hunk->final_commit_id);
431 0 1 wedge_line = (hunk->old_lines == 0) ? hunk->new_start : hunk->old_start;
435 0 1 if (!blame->current_hunk) {
438 0 0 GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
441 0 1 } else if (!hunk_starts_at_or_after_line(blame->current_hunk, wedge_line)){
445 0 0 GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
451 0 0 static int ptrs_equal_cmp(const void *a, const void *b) { return ab ? 1 : 0; }
464 1 1 if (line->origin == GIT_DIFF_LINE_ADDITION) {
474 0 1 GIT_ERROR_CHECK_ALLOC(blame->current_hunk);
481 1 1 if (line->origin == GIT_DIFF_LINE_DELETION) {
485 0 1 if (--(blame->current_hunk->lines_in_hunk) == 0) {
488 0 0 if (!git_vector_search2(&i, &blame->hunks, ptrs_equal_cmp, blame->current_hunk)) {
512 1 0 assert(out && reference && buffer && buffer_len);
1 0 assert(out && reference && buffer && buffer_len);
1 0 assert(out && reference && buffer && buffer_len);
0 1 assert(out && reference && buffer && buffer_len);
515 0 1 GIT_ERROR_CHECK_ALLOC(blame);
518 3 1 git_vector_foreach(&reference->hunks, i, hunk) {
520 0 3 GIT_ERROR_CHECK_ALLOC(h);
536 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(