unit-tests: do not mistake `.pdb` files for being executable
[git.git] / t / t2082-parallel-checkout-attributes.sh
blobf3511cd43a9ddc929c886ef7c44f4e4704b6c367
1 #!/bin/sh
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).
12 TEST_NO_CREATE_REPO=1
13 . ./test-lib.sh
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 &&
19 git init ident &&
21 cd ident &&
22 echo "A ident" >.gitattributes &&
23 echo "\$Id\$" >A &&
24 echo "\$Id\$" >B &&
25 git add -A &&
26 git commit -m id &&
28 rm A B &&
29 test_checkout_workers 2 git reset --hard &&
30 hexsz=$(test_oid hexsz) &&
31 grep -E "\\\$Id: [0-9a-f]{$hexsz} \\\$" A &&
32 grep "\\\$Id\\\$" B
36 test_expect_success 'parallel-checkout with re-encoding' '
37 set_checkout_config 2 0 &&
38 git init encoding &&
40 cd encoding &&
41 echo text >utf8-text &&
42 write_utf16 <utf8-text >utf16-text &&
44 echo "A working-tree-encoding=UTF-16" >.gitattributes &&
45 cp utf16-text A &&
46 cp utf8-text B &&
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 &&
54 rm A B &&
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 &&
65 git init eol &&
67 cd eol &&
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 &&
73 cp crlf-text A &&
74 cp lf-text B &&
75 git add A B .gitattributes &&
76 git commit -m eol &&
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 &&
82 rm A B &&
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 &&
97 git init filter &&
99 cd filter &&
100 write_script <<-\EOF rot13.sh &&
101 tr \
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 &&
111 echo nopq >rot13 &&
113 echo "A filter=rot13" >.gitattributes &&
114 cp original A &&
115 cp original B &&
116 cp original C &&
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 &&
134 test_cmp original C
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 &&
149 git init delayed &&
151 cd delayed &&
152 echo "*.d filter=delay" >.gitattributes &&
153 cp ../original W.d &&
154 cp ../original X.d &&
155 cp ../original Y &&
156 cp ../original Z &&
157 git add -A &&
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 &&
170 rm *
171 ) &&
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
184 # were not filtered
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
191 test_done