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.)
25 TEST_PASSES_SANITIZE_LEAK
=true
27 .
"$TEST_DIRECTORY"/lib-merge.sh
30 # Testcase basic, conflicting changes in 'numerals'
32 test_setup_numerals
() {
33 git init numerals_
$1 &&
38 test_write_lines I II III
>numerals
&&
39 git add README numerals
&&
48 test_write_lines I II III IIII
>numerals
&&
54 test_write_lines I II III IV
>numerals
&&
59 cat <<-EOF >expected-index &&
66 cat <<-EOF >expected-merge
80 test_expect_success
'conflicting entries written to worktree even if sparse' '
81 test_setup_numerals plain &&
87 test_path_is_file README &&
88 test_path_is_file numerals &&
90 git sparse-checkout init &&
91 git sparse-checkout set --no-cone README &&
93 test_path_is_file README &&
94 test_path_is_missing numerals &&
96 test_must_fail git merge -s recursive B^0 &&
98 git ls-files -t >index_files &&
99 test_cmp expected-index index_files &&
101 test_path_is_file README &&
102 test_path_is_file numerals &&
104 test_cmp expected-merge numerals &&
111 git ls-files -o >others &&
112 test_line_count = 4 others
116 test_expect_success
'present-despite-SKIP_WORKTREE handled reasonably' '
117 test_setup_numerals in_the_way &&
119 cd numerals_in_the_way &&
123 test_path_is_file README &&
124 test_path_is_file numerals &&
126 git sparse-checkout init &&
127 git sparse-checkout set --no-cone README &&
129 test_path_is_file README &&
130 test_path_is_missing numerals &&
132 echo foobar >numerals &&
134 test_must_fail git merge -s recursive B^0 &&
136 test_path_is_missing .git/MERGE_HEAD &&
138 test_path_is_file numerals &&
140 # numerals should still have "foobar" in it
141 echo foobar >expect &&
142 test_cmp expect numerals