Commit 03bdb2ad by Edward Thomson

GIT_EUNMERGED

parent 632d8b23
...@@ -28,6 +28,7 @@ enum { ...@@ -28,6 +28,7 @@ enum {
GIT_EUSER = -7, GIT_EUSER = -7,
GIT_EBAREREPO = -8, GIT_EBAREREPO = -8,
GIT_EORPHANEDHEAD = -9, GIT_EORPHANEDHEAD = -9,
GIT_EUNMERGED = -10,
GIT_PASSTHROUGH = -30, GIT_PASSTHROUGH = -30,
GIT_ITEROVER = -31, GIT_ITEROVER = -31,
......
...@@ -92,6 +92,7 @@ int git_reset( ...@@ -92,6 +92,7 @@ int git_reset(
if (reset_type == GIT_RESET_SOFT && (git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE)) { if (reset_type == GIT_RESET_SOFT && (git_repository_state(repo) == GIT_REPOSITORY_STATE_MERGE)) {
giterr_set(GITERR_OBJECT, "%s (soft) while in the middle of a merge.", ERROR_MSG); giterr_set(GITERR_OBJECT, "%s (soft) while in the middle of a merge.", ERROR_MSG);
error = GIT_EUNMERGED;
goto cleanup; goto cleanup;
} }
......
...@@ -120,6 +120,8 @@ void test_reset_soft__fails_when_merging(void) ...@@ -120,6 +120,8 @@ void test_reset_soft__fails_when_merging(void)
cl_git_pass(git_buf_joinpath(&merge_head_path, git_repository_path(repo), "MERGE_HEAD")); cl_git_pass(git_buf_joinpath(&merge_head_path, git_repository_path(repo), "MERGE_HEAD"));
cl_git_mkfile(git_buf_cstr(&merge_head_path), "beefbeefbeefbeefbeefbeefbeefbeefbeefbeef\n"); cl_git_mkfile(git_buf_cstr(&merge_head_path), "beefbeefbeefbeefbeefbeefbeefbeefbeefbeef\n");
cl_git_fail(git_reset(repo, target, GIT_RESET_SOFT)); retrieve_target_from_oid(&target, repo, KNOWN_COMMIT_IN_BARE_REPO);
cl_assert_equal_i(GIT_EUNMERGED, git_reset(repo, target, GIT_RESET_SOFT));
cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path))); cl_git_pass(p_unlink(git_buf_cstr(&merge_head_path)));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment