Branch Coverage

deps/libgit2/src/libgit2/patch.c
Criterion Covered Total %
branch 44 106 41.5


line true false branch
24 42 0 if (file_cb)
27 1 41 if (error)
30 1 40 if ((patch->delta->flags & GIT_DIFF_FLAG_BINARY) != 0) {
31 1 0 if (binary_cb)
37 22 18 if (!hunk_cb && !line_cb)
20 2 if (!hunk_cb && !line_cb)
40 39 0 for (i = 0; !error && i < git_array_size(patch->hunks); ++i) {
19 20 for (i = 0; !error && i < git_array_size(patch->hunks); ++i) {
41 19 0 git_patch_hunk *h = git_array_get(patch->hunks, i);
43 17 2 if (hunk_cb)
46 0 19 if (!line_cb)
49 57 0 for (j = 0; !error && j < h->line_count; ++j) {
38 19 for (j = 0; !error && j < h->line_count; ++j) {
51 38 0 git_array_get(patch->lines, h->line_start + j);
68 0 0 GIT_ASSERT_ARG(patch);
72 0 0 if (!include_context)
75 0 0 if (include_hunk_headers)
78 0 0 if (include_file_headers) {
81 0 0 if (git_diff_delta__format_file_header(
103 10 8 for (idx = 0; idx < git_array_size(patch->lines); ++idx) {
104 10 0 git_diff_line *line = git_array_get(patch->lines, idx);
105 0 10 if (!line)
120 2 6 if (total_ctxt)
122 8 0 if (total_adds)
124 8 0 if (total_dels)
132 0 3 GIT_ASSERT_ARG_WITH_RETVAL(patch, NULL);
138 0 10 GIT_ASSERT_ARG(patch);
155 0 4 GIT_ASSERT_ARG(patch);
157 4 0 hunk = git_array_get(patch->hunks, hunk_idx);
159 0 4 if (!hunk) {
160 0 0 if (out) *out = NULL;
161 0 0 if (lines_in_hunk) *lines_in_hunk = 0;
165 4 0 if (out) *out = &hunk->hunk;
166 0 4 if (lines_in_hunk) *lines_in_hunk = hunk->line_count;
173 0 0 GIT_ASSERT_ARG(patch);
175 0 0 if (!(hunk = git_array_get(patch->hunks, hunk_idx)))
0 0 if (!(hunk = git_array_get(patch->hunks, hunk_idx)))
189 0 0 GIT_ASSERT_ARG(patch);
191 0 0 if (!(hunk = git_array_get(patch->hunks, hunk_idx))) {
0 0 if (!(hunk = git_array_get(patch->hunks, hunk_idx))) {
192 0 0 if (out) *out = NULL;
196 0 0 if (line_of_hunk >= hunk->line_count ||
0 0 if (line_of_hunk >= hunk->line_count ||
197 0 0 !(line = git_array_get(
199 0 0 if (out) *out = NULL;
203 0 0 if (out) *out = line;
214 0 51 GIT_ASSERT_ARG(out);
215 0 51 GIT_ASSERT_ARG(diff);
216 0 51 GIT_ASSERT_ARG(diff->patch_fn);
222 52 0 if (patch->free_fn)
228 54 0 if (patch)
229 52 2 GIT_REFCOUNT_DEC(patch, git_patch__free);
52 0 GIT_REFCOUNT_DEC(patch, git_patch__free);