Branch Coverage

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


line true false branch
36 1 0 assert(pathspecs != NULL && pathspecs->count > 0);
0 1 assert(pathspecs != NULL && 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 assert(delta->status == GIT_DELTA_ADDED ||
0 1 assert(delta->status == GIT_DELTA_ADDED ||
0 0 assert(delta->status == GIT_DELTA_ADDED ||
0 0 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 2 0 assert(repo && target);
0 2 assert(repo && target);
118 1 1 if (checkout_opts)
121 0 2 if (git_object_owner(target) != repo) {
127 2 0 if (reset_type != GIT_RESET_SOFT &&
0 2 if (reset_type != GIT_RESET_SOFT &&
128 0 2 (error = git_repository__ensure_not_bare(repo,
132 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 ||
133 2 0 (error = git_repository_index(&index, repo)) < 0 ||
138 0 0 (git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE ||
146 0 2 if ((error = git_buf_printf(&log_message, "reset: moving to %s", to)) < 0)
149 2 0 if (reset_type == GIT_RESET_HARD) {
153 0 2 if ((error = git_checkout_tree(repo, (git_object *)tree, &opts)) < 0)
158 0 2 if ((error = git_reference__update_terminal(repo, GIT_HEAD_FILE,
162 2 0 if (reset_type > GIT_RESET_SOFT) {
165 2 0 if ((error = git_index_read_tree(index, tree)) < 0 ||
2 0 if ((error = git_index_read_tree(index, tree)) < 0 ||
169 0 2 if ((error = git_repository_state_cleanup(repo)) < 0) {