use strpbrk(3) to search for characters from a given set
[git/debian.git] / t / t1015-read-index-unmerged.sh
blob55d22da32ccdca701014c655a32041d0b5b89440
1 #!/bin/sh
3 test_description='Test various callers of read_index_unmerged'
4 . ./test-lib.sh
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 &&
12 git add 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")
18 echo i >>letters &&
19 echo "version 2" >letters.txt &&
20 git add letters letters.txt &&
21 git commit -m modified &&
23 git checkout -b delete HEAD^ &&
24 git rm letters &&
25 mkdir letters &&
26 >letters/file &&
27 echo "version 1" >letters.txt &&
28 git add letters letters.txt &&
29 git commit -m deleted
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 &&
57 git reset --hard &&
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 &&
70 git add numbers &&
71 git commit -m initial &&
73 git checkout -b d-edit &&
74 mkdir foo &&
75 echo content >foo/bar &&
76 git add foo &&
77 echo 11 >>numbers &&
78 git add numbers &&
79 git commit -m "directory and edit" &&
81 git checkout -b f-edit d-edit^1 &&
82 echo content >foo &&
83 git add foo &&
84 echo eleven >>numbers &&
85 git add 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 &&
99 git merge --abort &&
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 &&
116 git am --skip &&
117 test_path_is_missing .git/rebase-apply &&
118 git ls-files -u >conflicts &&
119 test_must_be_empty conflicts
123 test_done