Commit 42f98a26a5da450b3ef8600b85711112dd9860f4

Edward Thomson 2015-01-17T23:31:24

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.

diff --git a/tests/merge/workdir/setup.c b/tests/merge/workdir/setup.c
index 099bc12..31ffd57 100644
--- a/tests/merge/workdir/setup.c
+++ b/tests/merge/workdir/setup.c
@@ -1018,6 +1018,7 @@ void test_merge_workdir_setup__retained_after_success(void)
 	git_annotated_commit_free(their_heads[0]);
 }
 
+
 void test_merge_workdir_setup__removed_after_failure(void)
 {
 	git_oid our_oid;
@@ -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_annotated_commit_from_ref(&their_heads[0], repo, octo1_ref));
 
-	cl_git_rewritefile("merge-resolve/new-in-octo1.txt",
-		"Conflicting file!\n\nMerge will fail!\n");
+	cl_git_write2file("merge-resolve/.git/index.lock", "foo\n", 4, O_RDWR|O_CREAT, 0666);
 
 	cl_git_fail(git_merge(
 		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_ORIG_HEAD_FILE));
-	cl_assert(!git_path_exists("merge-resolve/" GIT_MERGE_MODE_FILE));
-	cl_assert(!git_path_exists("merge-resolve/" GIT_MERGE_MSG_FILE));
+	cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_HEAD_FILE));
+	cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_MODE_FILE));
+	cl_assert(!git_path_exists("merge-resolve/.git/" GIT_MERGE_MSG_FILE));
 
 	git_reference_free(octo1_ref);