3 test_description='Test various callers of read_index_unmerged'
6 test_expect_success 'setup modify/delete + directory/file conflict' '
7 test_create_repo df_plus_modify_delete &&
9 cd df_plus_modify_delete &&
11 test_write_lines a b c d e f g h >letters &&
13 git commit -m initial &&
15 git checkout -b modify &&
16 # Throw in letters.txt for sorting order fun
17 # ("letters.txt" sorts between "letters" and "letters/file")
19 echo "version 2" >letters.txt &&
20 git add letters letters.txt &&
21 git commit -m modified &&
23 git checkout -b delete HEAD^ &&
27 echo "version 1" >letters.txt &&
28 git add letters letters.txt &&
33 test_expect_success 'read-tree --reset cleans unmerged entries' '
34 test_when_finished "git -C df_plus_modify_delete clean -f" &&
35 test_when_finished "git -C df_plus_modify_delete reset --hard" &&
37 cd df_plus_modify_delete &&
39 git checkout delete^0 &&
40 test_must_fail git merge modify &&
42 git read-tree --reset HEAD &&
43 git ls-files -u >conflicts &&
44 test_must_be_empty conflicts
48 test_expect_success 'One reset --hard cleans unmerged entries' '
49 test_when_finished "git -C df_plus_modify_delete clean -f" &&
50 test_when_finished "git -C df_plus_modify_delete reset --hard" &&
52 cd df_plus_modify_delete &&
54 git checkout delete^0 &&
55 test_must_fail git merge modify &&
58 test_path_is_missing .git/MERGE_HEAD &&
59 git ls-files -u >conflicts &&
60 test_must_be_empty conflicts
64 test_expect_success 'setup directory/file conflict + simple edit/edit' '
65 test_create_repo df_plus_edit_edit &&
67 cd df_plus_edit_edit &&
69 test_seq 1 10 >numbers &&
71 git commit -m initial &&
73 git checkout -b d-edit &&
75 echo content >foo/bar &&
79 git commit -m "directory and edit" &&
81 git checkout -b f-edit d-edit^1 &&
84 echo eleven >>numbers &&
86 git commit -m "file and edit"
90 test_expect_success 'git merge --abort succeeds despite D/F conflict' '
91 test_when_finished "git -C df_plus_edit_edit clean -f" &&
92 test_when_finished "git -C df_plus_edit_edit reset --hard" &&
94 cd df_plus_edit_edit &&
96 git checkout f-edit^0 &&
97 test_must_fail git merge d-edit^0 &&
100 test_path_is_missing .git/MERGE_HEAD &&
101 git ls-files -u >conflicts &&
102 test_must_be_empty conflicts
106 test_expect_success 'git am --skip succeeds despite D/F conflict' '
107 test_when_finished "git -C df_plus_edit_edit clean -f" &&
108 test_when_finished "git -C df_plus_edit_edit reset --hard" &&
110 cd df_plus_edit_edit &&
112 git checkout f-edit^0 &&
113 git format-patch -1 d-edit &&
114 test_must_fail git am -3 0001*.patch &&
117 test_path_is_missing .git/rebase-apply &&
118 git ls-files -u >conflicts &&
119 test_must_be_empty conflicts