3 test_description
='parallel-checkout: attributes
5 Verify that parallel-checkout correctly creates files that require
6 conversions, as specified in .gitattributes. The main point here is
7 to check that the conv_attr data is correctly sent to the workers
8 and that it contains sufficient information to smudge files
9 properly (without access to the index or attribute stack).
13 TEST_PASSES_SANITIZE_LEAK
=true
15 .
"$TEST_DIRECTORY/lib-parallel-checkout.sh"
16 .
"$TEST_DIRECTORY/lib-encoding.sh"
18 test_expect_success
'parallel-checkout with ident' '
19 set_checkout_config 2 0 &&
23 echo "A ident" >.gitattributes &&
30 test_checkout_workers 2 git reset --hard &&
31 hexsz=$(test_oid hexsz) &&
32 grep -E "\\\$Id: [0-9a-f]{$hexsz} \\\$" A &&
37 test_expect_success ICONV
'parallel-checkout with re-encoding' '
38 set_checkout_config 2 0 &&
42 echo text >utf8-text &&
43 write_utf16 <utf8-text >utf16-text &&
45 echo "A working-tree-encoding=UTF-16" >.gitattributes &&
48 git add A B .gitattributes &&
49 git commit -m encoding &&
51 # Check that A is stored in UTF-8
52 git cat-file -p :A >A.internal &&
53 test_cmp_bin utf8-text A.internal &&
56 test_checkout_workers 2 git checkout A B &&
58 # Check that A (and only A) is re-encoded during checkout
59 test_cmp_bin utf16-text A &&
60 test_cmp_bin utf8-text B
64 test_expect_success
'parallel-checkout with eol conversions' '
65 set_checkout_config 2 0 &&
69 printf "multi\r\nline\r\ntext" >crlf-text &&
70 printf "multi\nline\ntext" >lf-text &&
72 git config core.autocrlf false &&
73 echo "A eol=crlf" >.gitattributes &&
76 git add A B .gitattributes &&
79 # Check that A is stored with LF format
80 git cat-file -p :A >A.internal &&
81 test_cmp_bin lf-text A.internal &&
84 test_checkout_workers 2 git checkout A B &&
86 # Check that A (and only A) is converted to CRLF during checkout
87 test_cmp_bin crlf-text A &&
88 test_cmp_bin lf-text B
92 # Entries that require an external filter are not eligible for parallel
93 # checkout. Check that both the parallel-eligible and non-eligible entries are
94 # properly written in a single checkout operation.
96 test_expect_success
'parallel-checkout and external filter' '
97 set_checkout_config 2 0 &&
101 write_script <<-\EOF rot13.sh &&
103 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
104 "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"
107 git config filter.rot13.clean "\"$(pwd)/rot13.sh\"" &&
108 git config filter.rot13.smudge "\"$(pwd)/rot13.sh\"" &&
109 git config filter.rot13.required true &&
111 echo abcd >original &&
114 echo "A filter=rot13" >.gitattributes &&
118 git add A B C .gitattributes &&
119 git commit -m filter &&
121 # Check that A (and only A) was cleaned
122 git cat-file -p :A >A.internal &&
123 test_cmp rot13 A.internal &&
124 git cat-file -p :B >B.internal &&
125 test_cmp original B.internal &&
126 git cat-file -p :C >C.internal &&
127 test_cmp original C.internal &&
129 rm A B C *.internal &&
130 test_checkout_workers 2 git checkout A B C &&
132 # Check that A (and only A) was smudged during checkout
133 test_cmp original A &&
134 test_cmp original B &&
139 # The delayed queue is independent from the parallel queue, and they should be
140 # able to work together in the same checkout process.
142 test_expect_success
'parallel-checkout and delayed checkout' '
143 test_config_global filter.delay.process \
144 "test-tool rot13-filter --always-delay --log=\"$(pwd)/delayed.log\" clean smudge delay" &&
145 test_config_global filter.delay.required true &&
147 echo "abcd" >original &&
148 echo "nopq" >rot13 &&
153 echo "*.d filter=delay" >.gitattributes &&
154 cp ../original W.d &&
155 cp ../original X.d &&
159 git commit -m delayed &&
161 # Check that *.d files were cleaned
162 git cat-file -p :W.d >W.d.internal &&
163 test_cmp W.d.internal ../rot13 &&
164 git cat-file -p :X.d >X.d.internal &&
165 test_cmp X.d.internal ../rot13 &&
166 git cat-file -p :Y >Y.internal &&
167 test_cmp Y.internal ../original &&
168 git cat-file -p :Z >Z.internal &&
169 test_cmp Z.internal ../original &&
174 set_checkout_config 2 0 &&
175 test_checkout_workers 2 git -C delayed checkout -f &&
176 verify_checkout delayed &&
178 # Check that the *.d files got to the delay queue and were filtered
179 grep "smudge W.d .* \[DELAYED\]" delayed.log &&
180 grep "smudge X.d .* \[DELAYED\]" delayed.log &&
181 test_cmp delayed/W.d original &&
182 test_cmp delayed/X.d original &&
184 # Check that the parallel-eligible entries went to the right queue and
186 ! grep "smudge Y .* \[DELAYED\]" delayed.log &&
187 ! grep "smudge Z .* \[DELAYED\]" delayed.log &&
188 test_cmp delayed/Y original &&
189 test_cmp delayed/Z original