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).
14 .
"$TEST_DIRECTORY/lib-parallel-checkout.sh"
15 .
"$TEST_DIRECTORY/lib-encoding.sh"
17 test_expect_success
'parallel-checkout with ident' '
18 set_checkout_config 2 0 &&
22 echo "A ident" >.gitattributes &&
29 test_checkout_workers 2 git reset --hard &&
30 hexsz=$(test_oid hexsz) &&
31 grep -E "\\\$Id: [0-9a-f]{$hexsz} \\\$" A &&
36 test_expect_success
'parallel-checkout with re-encoding' '
37 set_checkout_config 2 0 &&
41 echo text >utf8-text &&
42 write_utf16 <utf8-text >utf16-text &&
44 echo "A working-tree-encoding=UTF-16" >.gitattributes &&
47 git add A B .gitattributes &&
48 git commit -m encoding &&
50 # Check that A is stored in UTF-8
51 git cat-file -p :A >A.internal &&
52 test_cmp_bin utf8-text A.internal &&
55 test_checkout_workers 2 git checkout A B &&
57 # Check that A (and only A) is re-encoded during checkout
58 test_cmp_bin utf16-text A &&
59 test_cmp_bin utf8-text B
63 test_expect_success
'parallel-checkout with eol conversions' '
64 set_checkout_config 2 0 &&
68 printf "multi\r\nline\r\ntext" >crlf-text &&
69 printf "multi\nline\ntext" >lf-text &&
71 git config core.autocrlf false &&
72 echo "A eol=crlf" >.gitattributes &&
75 git add A B .gitattributes &&
78 # Check that A is stored with LF format
79 git cat-file -p :A >A.internal &&
80 test_cmp_bin lf-text A.internal &&
83 test_checkout_workers 2 git checkout A B &&
85 # Check that A (and only A) is converted to CRLF during checkout
86 test_cmp_bin crlf-text A &&
87 test_cmp_bin lf-text B
91 # Entries that require an external filter are not eligible for parallel
92 # checkout. Check that both the parallel-eligible and non-eligible entries are
93 # properly writen in a single checkout operation.
95 test_expect_success
'parallel-checkout and external filter' '
96 set_checkout_config 2 0 &&
100 write_script <<-\EOF rot13.sh &&
102 "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" \
103 "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"
106 git config filter.rot13.clean "\"$(pwd)/rot13.sh\"" &&
107 git config filter.rot13.smudge "\"$(pwd)/rot13.sh\"" &&
108 git config filter.rot13.required true &&
110 echo abcd >original &&
113 echo "A filter=rot13" >.gitattributes &&
117 git add A B C .gitattributes &&
118 git commit -m filter &&
120 # Check that A (and only A) was cleaned
121 git cat-file -p :A >A.internal &&
122 test_cmp rot13 A.internal &&
123 git cat-file -p :B >B.internal &&
124 test_cmp original B.internal &&
125 git cat-file -p :C >C.internal &&
126 test_cmp original C.internal &&
128 rm A B C *.internal &&
129 test_checkout_workers 2 git checkout A B C &&
131 # Check that A (and only A) was smudged during checkout
132 test_cmp original A &&
133 test_cmp original B &&
138 # The delayed queue is independent from the parallel queue, and they should be
139 # able to work together in the same checkout process.
141 test_expect_success
'parallel-checkout and delayed checkout' '
142 test_config_global filter.delay.process \
143 "test-tool rot13-filter --always-delay --log=\"$(pwd)/delayed.log\" clean smudge delay" &&
144 test_config_global filter.delay.required true &&
146 echo "abcd" >original &&
147 echo "nopq" >rot13 &&
152 echo "*.d filter=delay" >.gitattributes &&
153 cp ../original W.d &&
154 cp ../original X.d &&
158 git commit -m delayed &&
160 # Check that *.d files were cleaned
161 git cat-file -p :W.d >W.d.internal &&
162 test_cmp W.d.internal ../rot13 &&
163 git cat-file -p :X.d >X.d.internal &&
164 test_cmp X.d.internal ../rot13 &&
165 git cat-file -p :Y >Y.internal &&
166 test_cmp Y.internal ../original &&
167 git cat-file -p :Z >Z.internal &&
168 test_cmp Z.internal ../original &&
173 set_checkout_config 2 0 &&
174 test_checkout_workers 2 git -C delayed checkout -f &&
175 verify_checkout delayed &&
177 # Check that the *.d files got to the delay queue and were filtered
178 grep "smudge W.d .* \[DELAYED\]" delayed.log &&
179 grep "smudge X.d .* \[DELAYED\]" delayed.log &&
180 test_cmp delayed/W.d original &&
181 test_cmp delayed/X.d original &&
183 # Check that the parallel-eligible entries went to the right queue and
185 ! grep "smudge Y .* \[DELAYED\]" delayed.log &&
186 ! grep "smudge Z .* \[DELAYED\]" delayed.log &&
187 test_cmp delayed/Y original &&
188 test_cmp delayed/Z original