summaryrefslogtreecommitdiff
path: root/tests-clar/reset/soft.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests-clar/reset/soft.c')
-rw-r--r--tests-clar/reset/soft.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests-clar/reset/soft.c b/tests-clar/reset/soft.c
index 9ebd63763..884697c91 100644
--- a/tests-clar/reset/soft.c
+++ b/tests-clar/reset/soft.c
@@ -130,3 +130,28 @@ void test_reset_soft__fails_when_merging(void)
git_buf_free(&merge_head_path);
}
+
+void test_reset_soft__fails_when_index_contains_conflicts_independently_of_MERGE_HEAD_file_existence(void)
+{
+ git_index *index;
+ git_reference *head;
+ git_buf merge_head_path = GIT_BUF_INIT;
+
+ cl_git_sandbox_cleanup();
+
+ repo = cl_git_sandbox_init("mergedrepo");
+
+ cl_git_pass(git_buf_joinpath(&merge_head_path, git_repository_path(repo), "MERGE_HEAD"));
+ cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path)));
+ git_buf_free(&merge_head_path);
+
+ cl_git_pass(git_repository_index(&index, repo));
+ cl_assert_equal_i(true, git_index_has_conflicts(index));
+ git_index_free(index);
+
+ cl_git_pass(git_repository_head(&head, repo));
+ cl_git_pass(git_reference_peel(&target, head, GIT_OBJ_COMMIT));
+ git_reference_free(head);
+
+ cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT));
+}