Branch Coverage

deps/libgit2/src/revert.c
Criterion Covered Total %
branch 40 84 47.6


line true false branch
31 1 0 if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
1 0 if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
32 1 0 (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_REVERT_FILE_MODE)) >= 0 &&
36 0 1 if (error < 0)
53 1 0 if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
1 0 if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
54 1 0 (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_REVERT_FILE_MODE)) < 0 ||
62 0 1 if (error < 0)
82 1 0 if (given != NULL)
89 0 1 if (!opts->checkout_opts.checkout_strategy)
92 1 0 if (!opts->checkout_opts.our_label)
95 1 0 if (!opts->checkout_opts.their_label)
132 1 0 assert(out && repo && revert_commit && our_commit);
1 0 assert(out && repo && revert_commit && our_commit);
1 0 assert(out && repo && revert_commit && our_commit);
0 1 assert(out && repo && revert_commit && our_commit);
134 0 1 if (git_commit_parentcount(revert_commit) > 1) {
135 0 0 if (!mainline)
141 0 1 if (mainline)
148 1 0 if (parent &&
1 0 if (parent &&
149 1 0 ((error = git_commit_parent(&parent_commit, revert_commit, (parent - 1))) < 0 ||
153 1 0 if ((error = git_commit_tree(&revert_tree, revert_commit)) < 0 ||
1 0 if ((error = git_commit_tree(&revert_tree, revert_commit)) < 0 ||
183 1 0 assert(repo && commit);
0 1 assert(repo && commit);
185 0 1 GIT_ERROR_CHECK_VERSION(given_opts, GIT_REVERT_OPTIONS_VERSION, "git_revert_options");
187 0 1 if ((error = git_repository__ensure_not_bare(repo, "revert")) < 0)
193 0 1 if ((commit_msg = git_commit_summary(commit)) == NULL) {
198 1 0 if ((error = git_buf_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
1 0 if ((error = git_buf_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
199 1 0 (error = revert_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
200 1 0 (error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
201 1 0 (error = write_revert_head(repo, commit_oidstr)) < 0 ||
202 1 0 (error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
203 1 0 (error = git_repository_head(&our_ref, repo)) < 0 ||
204 1 0 (error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
205 1 0 (error = git_revert_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
206 1 0 (error = git_merge__check_result(repo, index)) < 0 ||
207 1 0 (error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||
208 1 0 (error = git_checkout_index(repo, index, &opts.checkout_opts)) < 0 ||
229 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(