Branch Coverage

deps/libgit2/src/diff.c
Criterion Covered Total %
branch 82 158 51.9


line true false branch
26 46 0 if (!str ||
46 0 if (!str ||
27 42 4 delta->status == GIT_DELTA_ADDED ||
28 0 42 delta->status == GIT_DELTA_RENAMED ||
44 0 23 return val ? val : ((int)da->status - (int)db->status);
51 0 0 return val ? val : ((int)da->status - (int)db->status);
72 307 357 if (!diff)
75 303 54 GIT_REFCOUNT_DEC(diff, diff->free_fn);
303 0 GIT_REFCOUNT_DEC(diff, diff->free_fn);
85 0 59 assert(diff);
94 0 0 assert(diff);
96 0 0 git_vector_foreach(&diff->deltas, i, delta) {
105 0 61 assert(diff);
116 0 0 assert(out);
117 0 0 GIT_ERROR_CHECK_VERSION(out, GIT_DIFF_PERFDATA_VERSION, "git_diff_perfdata");
135 0 22 assert(diff);
137 32 21 git_vector_foreach(&diff->deltas, idx, delta) {
141 0 32 if (git_diff_delta__should_skip(&diff->opts, delta))
144 0 32 if ((error = git_patch_from_diff(&patch, diff, idx)) != 0)
151 1 31 if (error)
175 0 3 if ((error = git__date_rfc2822_fmt(date_str, sizeof(date_str),
188 0 3 if (error < 0)
191 2 1 if (!exclude_patchno_marker) {
192 1 1 if (total_patches == 1) {
199 0 2 if (error < 0)
205 0 3 if (body) {
208 0 0 if (out->ptr[out->size - 1] != '\n')
224 3 3 for (i = 0; i < deltas; ++i) {
227 3 0 if ((error = git_patch_from_diff(&patch, diff, i)) >= 0)
232 0 3 if (error < 0)
251 3 0 assert(out && diff && opts);
3 0 assert(out && diff && opts);
0 3 assert(out && diff && opts);
252 3 0 assert(opts->summary && opts->id && opts->author);
3 0 assert(opts->summary && opts->id && opts->author);
0 3 assert(opts->summary && opts->id && opts->author);
254 0 3 GIT_ERROR_CHECK_VERSION(opts,
261 2 1 if (!ignore_marker) {
262 0 2 if (opts->patch_no > opts->total_patches) {
269 0 2 if (opts->patch_no == 0) {
279 0 3 if ((loc = strpbrk(opts->summary, "\r\n")) != NULL) {
282 0 0 if ((offset = (loc - opts->summary)) == 0) {
288 0 0 GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
0 0 GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
290 0 0 GIT_ERROR_CHECK_ALLOC(summary);
295 3 0 error = git_diff_format_email__append_header_tobuf(out,
299 0 3 if (error < 0)
304 3 0 if ((error = git_buf_puts(out, "---\n")) < 0 ||
3 0 if ((error = git_buf_puts(out, "---\n")) < 0 ||
305 3 0 (error = git_diff_get_stats(&stats, diff)) < 0 ||
306 3 0 (error = git_diff_stats_to_buf(out, stats, format_flags, 0)) < 0 ||
307 3 0 (error = git_buf_putc(out, '\n')) < 0 ||
334 3 0 assert (out && repo && commit);
3 0 assert (out && repo && commit);
0 3 assert (out && repo && commit);
344 0 3 if ((error = git_diff__commit(&diff, repo, commit, diff_opts)) < 0)
355 0 1 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
368 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
382 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
400 2 0 if ((error = git_hash_final(&hash, ctx)) < 0 ||
0 2 if ((error = git_hash_final(&hash, ctx)) < 0 ||
404 40 2 for (i = 0; i < GIT_OID_RAWSZ; i++) {
419 134 5 while ((c = *src++) != '\0') {
420 110 24 if (!git__isspace(c)) {
439 5 0 if (line->origin == GIT_DIFF_LINE_CONTEXT_EOFNL ||
5 0 if (line->origin == GIT_DIFF_LINE_CONTEXT_EOFNL ||
440 5 0 line->origin == GIT_DIFF_LINE_ADD_EOFNL ||
444 0 5 if ((error = git_diff_print_callback__to_buf(delta, hunk,
450 2 3 if (line->origin == GIT_DIFF_LINE_FILE_HDR &&
1 1 if (line->origin == GIT_DIFF_LINE_FILE_HDR &&
451 0 1 !args->first_file &&
455 0 5 if ((error = git_hash_update(&args->ctx, buf.ptr, buf.size)) < 0)
458 2 3 if (line->origin == GIT_DIFF_LINE_FILE_HDR && args->first_file)
1 1 if (line->origin == GIT_DIFF_LINE_FILE_HDR && args->first_file)
468 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
478 0 1 GIT_ERROR_CHECK_VERSION(
483 0 1 if ((error = git_hash_ctx_init(&args.ctx)) < 0)
486 0 1 if ((error = git_diff_print(diff,
492 0 1 if ((error = (flush_hunk(&args.result, &args.ctx))) < 0)