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 ||
39 0 23 return val ? val : ((int)da->status - (int)db->status);
46 0 0 return val ? val : ((int)da->status - (int)db->status);
67 307 357 if (!diff)
70 303 54 GIT_REFCOUNT_DEC(diff, diff->free_fn);
303 0 GIT_REFCOUNT_DEC(diff, diff->free_fn);
80 0 59 assert(diff);
89 0 0 assert(diff);
91 0 0 git_vector_foreach(&diff->deltas, i, delta) {
100 0 61 assert(diff);
111 0 0 assert(out);
112 0 0 GIT_ERROR_CHECK_VERSION(out, GIT_DIFF_PERFDATA_VERSION, "git_diff_perfdata");
130 0 22 assert(diff);
132 32 21 git_vector_foreach(&diff->deltas, idx, delta) {
136 0 32 if (git_diff_delta__should_skip(&diff->opts, delta))
139 0 32 if ((error = git_patch_from_diff(&patch, diff, idx)) != 0)
146 1 31 if (error)
170 0 3 if ((error = git__date_rfc2822_fmt(date_str, sizeof(date_str),
183 0 3 if (error < 0)
186 2 1 if (!exclude_patchno_marker) {
187 1 1 if (total_patches == 1) {
194 0 2 if (error < 0)
200 0 3 if (body) {
203 0 0 if (out->ptr[out->size - 1] != '\n')
219 3 3 for (i = 0; i < deltas; ++i) {
222 3 0 if ((error = git_patch_from_diff(&patch, diff, i)) >= 0)
227 0 3 if (error < 0)
246 3 0 assert(out && diff && opts);
3 0 assert(out && diff && opts);
0 3 assert(out && diff && opts);
247 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);
249 0 3 GIT_ERROR_CHECK_VERSION(opts,
256 2 1 if (!ignore_marker) {
257 0 2 if (opts->patch_no > opts->total_patches) {
264 0 2 if (opts->patch_no == 0) {
274 0 3 if ((loc = strpbrk(opts->summary, "\r\n")) != NULL) {
277 0 0 if ((offset = (loc - opts->summary)) == 0) {
283 0 0 GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
0 0 GIT_ERROR_CHECK_ALLOC_ADD(&allocsize, offset, 1);
285 0 0 GIT_ERROR_CHECK_ALLOC(summary);
290 3 0 error = diff_format_email_append_header_tobuf(out,
294 0 3 if (error < 0)
299 3 0 if ((error = git_buf_puts(out, "---\n")) < 0 ||
3 0 if ((error = git_buf_puts(out, "---\n")) < 0 ||
300 3 0 (error = git_diff_get_stats(&stats, diff)) < 0 ||
301 3 0 (error = git_diff_stats_to_buf(out, stats, format_flags, 0)) < 0 ||
302 3 0 (error = git_buf_putc(out, '\n')) < 0 ||
329 3 0 assert (out && repo && commit);
3 0 assert (out && repo && commit);
0 3 assert (out && repo && commit);
339 0 3 if ((error = git_diff__commit(&diff, repo, commit, diff_opts)) < 0)
350 0 1 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
365 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
381 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
401 2 0 if ((error = git_hash_final(&hash, ctx)) < 0 ||
0 2 if ((error = git_hash_final(&hash, ctx)) < 0 ||
405 40 2 for (i = 0; i < GIT_OID_RAWSZ; i++) {
420 134 5 while ((c = *src++) != '\0') {
421 110 24 if (!git__isspace(c)) {
440 5 0 if (line->origin == GIT_DIFF_LINE_CONTEXT_EOFNL ||
5 0 if (line->origin == GIT_DIFF_LINE_CONTEXT_EOFNL ||
441 5 0 line->origin == GIT_DIFF_LINE_ADD_EOFNL ||
445 0 5 if ((error = git_diff_print_callback__to_buf(delta, hunk,
451 2 3 if (line->origin == GIT_DIFF_LINE_FILE_HDR &&
1 1 if (line->origin == GIT_DIFF_LINE_FILE_HDR &&
452 0 1 !args->first_file &&
456 0 5 if ((error = git_hash_update(&args->ctx, buf.ptr, buf.size)) < 0)
459 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)
469 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(
479 0 1 GIT_ERROR_CHECK_VERSION(
484 0 1 if ((error = git_hash_ctx_init(&args.ctx)) < 0)
487 0 1 if ((error = git_diff_print(diff,
493 0 1 if ((error = (flush_hunk(&args.result, &args.ctx))) < 0)