Branch Coverage

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


line true false branch
31 1 0 if ((error = git_str_joinpath(&file_path, repo->gitdir, GIT_REVERT_HEAD_FILE)) >= 0 &&
1 0 if ((error = git_str_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_str_joinpath(&file_path, repo->gitdir, GIT_MERGE_MSG_FILE)) < 0 ||
1 0 if ((error = git_str_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 0 1 GIT_ASSERT_ARG(out);
133 0 1 GIT_ASSERT_ARG(repo);
134 0 1 GIT_ASSERT_ARG(revert_commit);
135 0 1 GIT_ASSERT_ARG(our_commit);
137 0 1 if (git_commit_parentcount(revert_commit) > 1) {
138 0 0 if (!mainline)
144 0 1 if (mainline)
151 1 0 if (parent &&
1 0 if (parent &&
152 1 0 ((error = git_commit_parent(&parent_commit, revert_commit, (parent - 1))) < 0 ||
156 1 0 if ((error = git_commit_tree(&revert_tree, revert_commit)) < 0 ||
1 0 if ((error = git_commit_tree(&revert_tree, revert_commit)) < 0 ||
186 0 1 GIT_ASSERT_ARG(repo);
187 0 1 GIT_ASSERT_ARG(commit);
189 0 1 GIT_ERROR_CHECK_VERSION(given_opts, GIT_REVERT_OPTIONS_VERSION, "git_revert_options");
191 0 1 if ((error = git_repository__ensure_not_bare(repo, "revert")) < 0)
197 0 1 if ((commit_msg = git_commit_summary(commit)) == NULL) {
202 1 0 if ((error = git_str_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
1 0 if ((error = git_str_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
203 1 0 (error = revert_normalize_opts(repo, &opts, given_opts, git_str_cstr(&their_label))) < 0 ||
204 1 0 (error = git_indexwriter_init_for_operation(&indexwriter, repo, &opts.checkout_opts.checkout_strategy)) < 0 ||
205 1 0 (error = write_revert_head(repo, commit_oidstr)) < 0 ||
206 1 0 (error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
207 1 0 (error = git_repository_head(&our_ref, repo)) < 0 ||
208 1 0 (error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJECT_COMMIT)) < 0 ||
209 1 0 (error = git_revert_commit(&index, repo, commit, our_commit, opts.mainline, &opts.merge_opts)) < 0 ||
210 1 0 (error = git_merge__check_result(repo, index)) < 0 ||
211 1 0 (error = git_merge__append_conflicts_to_merge_msg(repo, index)) < 0 ||
212 1 0 (error = git_checkout_index(repo, index, &opts.checkout_opts)) < 0 ||
233 0 0 GIT_INIT_STRUCTURE_FROM_TEMPLATE(