Branch Coverage

deps/libgit2/src/libgit2/reset.c
Criterion Covered Total %
branch 34 76 44.7


line true false branch
36 1 0 GIT_ASSERT_ARG(pathspecs && pathspecs->count > 0);
0 1 GIT_ASSERT_ARG(pathspecs && pathspecs->count > 0);
40 0 1 if ((error = git_repository_index(&index, repo)) < 0)
43 1 0 if (target) {
44 0 1 if (git_object_owner(target) != repo) {
50 1 0 if ((error = git_object_peel(&commit, target, GIT_OBJECT_COMMIT)) < 0 ||
1 0 if ((error = git_object_peel(&commit, target, GIT_OBJECT_COMMIT)) < 0 ||
58 0 1 if ((error = git_diff_tree_to_index(
62 1 1 for (i = 0, max_i = git_diff_num_deltas(diff); i < max_i; ++i) {
65 1 0 GIT_ASSERT(delta->status == GIT_DELTA_ADDED ||
0 1 GIT_ASSERT(delta->status == GIT_DELTA_ADDED ||
0 0 GIT_ASSERT(delta->status == GIT_DELTA_ADDED ||
0 0 GIT_ASSERT(delta->status == GIT_DELTA_ADDED ||
71 0 1 if (error < 0) {
72 0 0 if (delta->status == GIT_DELTA_ADDED && error == GIT_ENOTFOUND)
0 0 if (delta->status == GIT_DELTA_ADDED && error == GIT_ENOTFOUND)
78 0 1 if (delta->status == GIT_DELTA_DELETED) {
79 0 0 if ((error = git_index_remove(index, delta->old_file.path, 0)) < 0)
86 0 1 if ((error = git_index_add(index, &entry)) < 0)
116 0 2 GIT_ASSERT_ARG(repo);
117 0 2 GIT_ASSERT_ARG(target);
119 1 1 if (checkout_opts)
122 0 2 if (git_object_owner(target) != repo) {
128 2 0 if (reset_type != GIT_RESET_SOFT &&
0 2 if (reset_type != GIT_RESET_SOFT &&
129 0 2 (error = git_repository__ensure_not_bare(repo,
133 2 0 if ((error = git_object_peel(&commit, target, GIT_OBJECT_COMMIT)) < 0 ||
2 0 if ((error = git_object_peel(&commit, target, GIT_OBJECT_COMMIT)) < 0 ||
134 2 0 (error = git_repository_index(&index, repo)) < 0 ||
139 0 0 (git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE ||
147 0 2 if ((error = git_str_printf(&log_message, "reset: moving to %s", to)) < 0)
150 2 0 if (reset_type == GIT_RESET_HARD) {
154 0 2 if ((error = git_checkout_tree(repo, (git_object *)tree, &opts)) < 0)
159 0 2 if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE,
163 2 0 if (reset_type > GIT_RESET_SOFT) {
166 2 0 if ((error = git_index_read_tree(index, tree)) < 0 ||
2 0 if ((error = git_index_read_tree(index, tree)) < 0 ||
170 0 2 if ((error = git_repository_state_cleanup(repo)) < 0) {