The eleventh batch
[alt-git.git] / t / t1015-read-index-unmerged.sh
blobda737a32a271185882b6f1fb6b190e7e82d90a48
1 #!/bin/sh
3 test_description='Test various callers of read_index_unmerged'
5 TEST_PASSES_SANITIZE_LEAK=true
6 . ./test-lib.sh
8 test_expect_success 'setup modify/delete + directory/file conflict' '
9 test_create_repo df_plus_modify_delete &&
11 cd df_plus_modify_delete &&
13 test_write_lines a b c d e f g h >letters &&
14 git add letters &&
15 git commit -m initial &&
17 git checkout -b modify &&
18 # Throw in letters.txt for sorting order fun
19 # ("letters.txt" sorts between "letters" and "letters/file")
20 echo i >>letters &&
21 echo "version 2" >letters.txt &&
22 git add letters letters.txt &&
23 git commit -m modified &&
25 git checkout -b delete HEAD^ &&
26 git rm letters &&
27 mkdir letters &&
28 >letters/file &&
29 echo "version 1" >letters.txt &&
30 git add letters letters.txt &&
31 git commit -m deleted
35 test_expect_success 'read-tree --reset cleans unmerged entries' '
36 test_when_finished "git -C df_plus_modify_delete clean -f" &&
37 test_when_finished "git -C df_plus_modify_delete reset --hard" &&
39 cd df_plus_modify_delete &&
41 git checkout delete^0 &&
42 test_must_fail git merge modify &&
44 git read-tree --reset HEAD &&
45 git ls-files -u >conflicts &&
46 test_must_be_empty conflicts
50 test_expect_success 'One reset --hard cleans unmerged entries' '
51 test_when_finished "git -C df_plus_modify_delete clean -f" &&
52 test_when_finished "git -C df_plus_modify_delete reset --hard" &&
54 cd df_plus_modify_delete &&
56 git checkout delete^0 &&
57 test_must_fail git merge modify &&
59 git reset --hard &&
60 test_path_is_missing .git/MERGE_HEAD &&
61 git ls-files -u >conflicts &&
62 test_must_be_empty conflicts
66 test_expect_success 'setup directory/file conflict + simple edit/edit' '
67 test_create_repo df_plus_edit_edit &&
69 cd df_plus_edit_edit &&
71 test_seq 1 10 >numbers &&
72 git add numbers &&
73 git commit -m initial &&
75 git checkout -b d-edit &&
76 mkdir foo &&
77 echo content >foo/bar &&
78 git add foo &&
79 echo 11 >>numbers &&
80 git add numbers &&
81 git commit -m "directory and edit" &&
83 git checkout -b f-edit d-edit^1 &&
84 echo content >foo &&
85 git add foo &&
86 echo eleven >>numbers &&
87 git add numbers &&
88 git commit -m "file and edit"
92 test_expect_success 'git merge --abort succeeds despite D/F conflict' '
93 test_when_finished "git -C df_plus_edit_edit clean -f" &&
94 test_when_finished "git -C df_plus_edit_edit reset --hard" &&
96 cd df_plus_edit_edit &&
98 git checkout f-edit^0 &&
99 test_must_fail git merge d-edit^0 &&
101 git merge --abort &&
102 test_path_is_missing .git/MERGE_HEAD &&
103 git ls-files -u >conflicts &&
104 test_must_be_empty conflicts
108 test_expect_success 'git am --skip succeeds despite D/F conflict' '
109 test_when_finished "git -C df_plus_edit_edit clean -f" &&
110 test_when_finished "git -C df_plus_edit_edit reset --hard" &&
112 cd df_plus_edit_edit &&
114 git checkout f-edit^0 &&
115 git format-patch -1 d-edit &&
116 test_must_fail git am -3 0001*.patch &&
118 git am --skip &&
119 test_path_is_missing .git/rebase-apply &&
120 git ls-files -u >conflicts &&
121 test_must_be_empty conflicts
125 test_done