Commit 26564d80aa7b340f07e9c5b96457928ebadcc606

Edward Thomson 2014-04-23T19:26:58

merge: default checkout strategy for should be SAFE

diff --git a/src/merge.c b/src/merge.c
index 2e40b6d..0b73d2b 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -2186,7 +2186,7 @@ static int merge_normalize_checkout_opts(
 	const git_merge_head **their_heads)
 {
 	int error = 0;
-	unsigned int default_checkout_strategy = GIT_CHECKOUT_SAFE_CREATE |
+	unsigned int default_checkout_strategy = GIT_CHECKOUT_SAFE |
 		GIT_CHECKOUT_ALLOW_CONFLICTS;
 
 	GIT_UNUSED(repo);
diff --git a/tests/merge/workdir/dirty.c b/tests/merge/workdir/dirty.c
index 1d596c5..6c21c2a 100644
--- a/tests/merge/workdir/dirty.c
+++ b/tests/merge/workdir/dirty.c
@@ -260,6 +260,23 @@ void test_merge_workdir_dirty__unaffected_dirty_files_allowed(void)
 		cl_git_pass(merge_dirty_files(files));
 }
 
+void test_merge_workdir_dirty__unstaged_deletes_maintained(void)
+{
+	git_reference *head;
+	git_object *head_object;
+
+	cl_git_pass(git_repository_head(&head, repo));
+	cl_git_pass(git_reference_peel(&head_object, head, GIT_OBJ_COMMIT));
+	cl_git_pass(git_reset(repo, head_object, GIT_RESET_HARD, NULL, NULL));
+
+	cl_git_pass(p_unlink("merge-resolve/unchanged.txt"));
+
+	cl_git_pass(merge_branch(0, 0));
+
+	git_object_free(head_object);
+	git_reference_free(head);
+}
+
 void test_merge_workdir_dirty__affected_dirty_files_disallowed(void)
 {
 	char **files;