3 test_description
="merge cases"
5 # The setup for all of them, pictorially, is:
15 # To help make it easier to follow the flow of tests, they have been
16 # divided into sections and each test will start with a quick explanation
17 # of what commits O, A, and B contain.
20 # z/{b,c} means files z/b and z/c both exist
21 # x/d_1 means file x/d exists with content d1. (Purpose of the
22 # underscore notation is to differentiate different
23 # files that might be renamed into each other's paths.)
26 .
"$TEST_DIRECTORY"/lib-merge.sh
29 # Testcase basic, conflicting changes in 'numerals'
31 test_setup_numerals
() {
32 git init numerals_
$1 &&
37 test_write_lines I II III
>numerals
&&
38 git add README numerals
&&
47 test_write_lines I II III IIII
>numerals
&&
53 test_write_lines I II III IV
>numerals
&&
58 cat <<-EOF >expected-index &&
65 cat <<-EOF >expected-merge
79 test_expect_success
'conflicting entries written to worktree even if sparse' '
80 test_setup_numerals plain &&
86 test_path_is_file README &&
87 test_path_is_file numerals &&
89 git sparse-checkout init &&
90 git sparse-checkout set --no-cone README &&
92 test_path_is_file README &&
93 test_path_is_missing numerals &&
95 test_must_fail git merge -s recursive B^0 &&
97 git ls-files -t >index_files &&
98 test_cmp expected-index index_files &&
100 test_path_is_file README &&
101 test_path_is_file numerals &&
103 test_cmp expected-merge numerals &&
110 git ls-files -o >others &&
111 test_line_count = 4 others
115 test_expect_success
'present-despite-SKIP_WORKTREE handled reasonably' '
116 test_setup_numerals in_the_way &&
118 cd numerals_in_the_way &&
122 test_path_is_file README &&
123 test_path_is_file numerals &&
125 git sparse-checkout init &&
126 git sparse-checkout set --no-cone README &&
128 test_path_is_file README &&
129 test_path_is_missing numerals &&
131 echo foobar >numerals &&
133 test_must_fail git merge -s recursive B^0 &&
135 test_path_is_missing .git/MERGE_HEAD &&
137 test_path_is_file numerals &&
139 # numerals should still have "foobar" in it
140 echo foobar >expect &&
141 test_cmp expect numerals