Commit 42f98a26 by Edward Thomson

merge test: test an actual failure, not conflict

Correct the merge failed cleanup test.  Merge data should not be
cleaned up on conflicts, only on actual failure.  And ORIG_HEAD
should not be removed at all.
parent 57f45e7f
...@@ -1018,6 +1018,7 @@ void test_merge_workdir_setup__retained_after_success(void) ...@@ -1018,6 +1018,7 @@ void test_merge_workdir_setup__retained_after_success(void)
git_annotated_commit_free(their_heads[0]); git_annotated_commit_free(their_heads[0]);
} }
void test_merge_workdir_setup__removed_after_failure(void) void test_merge_workdir_setup__removed_after_failure(void)
{ {
git_oid our_oid; git_oid our_oid;
...@@ -1030,16 +1031,14 @@ void test_merge_workdir_setup__removed_after_failure(void) ...@@ -1030,16 +1031,14 @@ void test_merge_workdir_setup__removed_after_failure(void)
cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH)); cl_git_pass(git_reference_lookup(&octo1_ref, repo, GIT_REFS_HEADS_DIR OCTO1_BRANCH));
cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref)); cl_git_pass(git_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
cl_git_rewritefile("merge-resolve/new-in-octo1.txt", cl_git_write2file("merge-resolve/.git/index.lock", "foo\n", 4, O_RDWR|O_CREAT, 0666);
"Conflicting file!\n\nMerge will fail!\n");
cl_git_fail(git_merge( cl_git_fail(git_merge(
repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL)); repo, (const git_annotated_commit **)&their_heads[0], 1, NULL, NULL));
cl_assert(!git_path_exists("merge-resolve/" GIT_MERGE_HEAD_FILE)); cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_HEAD_FILE));
cl_assert(!git_path_exists("merge-resolve/" GIT_ORIG_HEAD_FILE)); cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_MODE_FILE));
cl_assert(!git_path_exists("merge-resolve/" GIT_MERGE_MODE_FILE)); cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_MSG_FILE));
cl_assert(!git_path_exists("merge-resolve/" GIT_MERGE_MSG_FILE));
git_reference_free(octo1_ref); git_reference_free(octo1_ref);
......
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