]>
Commit | Line | Data |
---|---|---|
94c0956b DS |
1 | #!/bin/sh |
2 | ||
3 | test_description='sparse checkout builtin tests' | |
4 | ||
5 | . ./test-lib.sh | |
6 | ||
761e3d26 EM |
7 | list_files() { |
8 | # Do not replace this with 'ls "$1"', as "ls" with BSD-lineage | |
9 | # enables "-A" by default for root and ends up including ".git" and | |
10 | # such in its output. (Note, though, that running the test suite as | |
11 | # root is generally not recommended.) | |
12 | (cd "$1" && printf '%s\n' *) | |
13 | } | |
14 | ||
522e6417 DS |
15 | check_files() { |
16 | list_files "$1" >actual && | |
17 | shift && | |
18 | printf "%s\n" $@ >expect && | |
19 | test_cmp expect actual | |
20 | } | |
21 | ||
94c0956b DS |
22 | test_expect_success 'setup' ' |
23 | git init repo && | |
24 | ( | |
25 | cd repo && | |
26 | echo "initial" >a && | |
27 | mkdir folder1 folder2 deep && | |
28 | mkdir deep/deeper1 deep/deeper2 && | |
29 | mkdir deep/deeper1/deepest && | |
30 | cp a folder1 && | |
31 | cp a folder2 && | |
32 | cp a deep && | |
33 | cp a deep/deeper1 && | |
34 | cp a deep/deeper2 && | |
35 | cp a deep/deeper1/deepest && | |
36 | git add . && | |
37 | git commit -m "initial commit" | |
38 | ) | |
39 | ' | |
40 | ||
41 | test_expect_success 'git sparse-checkout list (empty)' ' | |
42 | git -C repo sparse-checkout list >list 2>err && | |
43 | test_must_be_empty list && | |
44 | test_i18ngrep "this worktree is not sparse (sparse-checkout file may not exist)" err | |
45 | ' | |
46 | ||
47 | test_expect_success 'git sparse-checkout list (populated)' ' | |
48 | test_when_finished rm -f repo/.git/info/sparse-checkout && | |
d622c343 DS |
49 | cat >repo/.git/info/sparse-checkout <<-\EOF && |
50 | /folder1/* | |
51 | /deep/ | |
52 | **/a | |
53 | !*bin* | |
94c0956b DS |
54 | EOF |
55 | cp repo/.git/info/sparse-checkout expect && | |
56 | git -C repo sparse-checkout list >list && | |
57 | test_cmp expect list | |
58 | ' | |
59 | ||
bab3c359 DS |
60 | test_expect_success 'git sparse-checkout init' ' |
61 | git -C repo sparse-checkout init && | |
d622c343 DS |
62 | cat >expect <<-\EOF && |
63 | /* | |
64 | !/*/ | |
bab3c359 DS |
65 | EOF |
66 | test_cmp expect repo/.git/info/sparse-checkout && | |
67 | test_cmp_config -C repo true core.sparsecheckout && | |
522e6417 | 68 | check_files repo a |
bab3c359 DS |
69 | ' |
70 | ||
71 | test_expect_success 'git sparse-checkout list after init' ' | |
72 | git -C repo sparse-checkout list >actual && | |
d622c343 DS |
73 | cat >expect <<-\EOF && |
74 | /* | |
75 | !/*/ | |
bab3c359 DS |
76 | EOF |
77 | test_cmp expect actual | |
78 | ' | |
79 | ||
80 | test_expect_success 'init with existing sparse-checkout' ' | |
81 | echo "*folder*" >> repo/.git/info/sparse-checkout && | |
82 | git -C repo sparse-checkout init && | |
d622c343 DS |
83 | cat >expect <<-\EOF && |
84 | /* | |
85 | !/*/ | |
86 | *folder* | |
bab3c359 DS |
87 | EOF |
88 | test_cmp expect repo/.git/info/sparse-checkout && | |
522e6417 | 89 | check_files repo a folder1 folder2 |
bab3c359 DS |
90 | ' |
91 | ||
d89f09c8 | 92 | test_expect_success 'clone --sparse' ' |
47dbf10d | 93 | git clone --sparse "file://$(pwd)/repo" clone && |
d89f09c8 | 94 | git -C clone sparse-checkout list >actual && |
d622c343 DS |
95 | cat >expect <<-\EOF && |
96 | /* | |
97 | !/*/ | |
d89f09c8 DS |
98 | EOF |
99 | test_cmp expect actual && | |
522e6417 | 100 | check_files clone a |
d89f09c8 DS |
101 | ' |
102 | ||
f6039a94 DS |
103 | test_expect_success 'set enables config' ' |
104 | git init empty-config && | |
105 | ( | |
106 | cd empty-config && | |
107 | test_commit test file && | |
108 | test_path_is_missing .git/config.worktree && | |
109 | test_must_fail git sparse-checkout set nothing && | |
110 | test_path_is_file .git/config.worktree && | |
111 | test_must_fail git config core.sparseCheckout && | |
112 | git sparse-checkout set "/*" && | |
113 | test_cmp_config true core.sparseCheckout | |
114 | ) | |
115 | ' | |
116 | ||
117 | test_expect_success 'set sparse-checkout using builtin' ' | |
118 | git -C repo sparse-checkout set "/*" "!/*/" "*folder*" && | |
d622c343 DS |
119 | cat >expect <<-\EOF && |
120 | /* | |
121 | !/*/ | |
122 | *folder* | |
f6039a94 DS |
123 | EOF |
124 | git -C repo sparse-checkout list >actual && | |
125 | test_cmp expect actual && | |
126 | test_cmp expect repo/.git/info/sparse-checkout && | |
522e6417 | 127 | check_files repo a folder1 folder2 |
f6039a94 DS |
128 | ' |
129 | ||
7bffca95 | 130 | test_expect_success 'set sparse-checkout using --stdin' ' |
d622c343 DS |
131 | cat >expect <<-\EOF && |
132 | /* | |
133 | !/*/ | |
134 | /folder1/ | |
135 | /folder2/ | |
7bffca95 DS |
136 | EOF |
137 | git -C repo sparse-checkout set --stdin <expect && | |
138 | git -C repo sparse-checkout list >actual && | |
139 | test_cmp expect actual && | |
140 | test_cmp expect repo/.git/info/sparse-checkout && | |
522e6417 | 141 | check_files repo "a folder1 folder2" |
7bffca95 DS |
142 | ' |
143 | ||
2631dc87 DS |
144 | test_expect_success 'add to sparse-checkout' ' |
145 | cat repo/.git/info/sparse-checkout >expect && | |
146 | cat >add <<-\EOF && | |
147 | pattern1 | |
148 | /folder1/ | |
149 | pattern2 | |
150 | EOF | |
151 | cat add >>expect && | |
152 | git -C repo sparse-checkout add --stdin <add && | |
153 | git -C repo sparse-checkout list >actual && | |
154 | test_cmp expect actual && | |
155 | test_cmp expect repo/.git/info/sparse-checkout && | |
156 | check_files repo "a folder1 folder2" | |
157 | ' | |
158 | ||
879321eb DS |
159 | test_expect_success 'cone mode: match patterns' ' |
160 | git -C repo config --worktree core.sparseCheckoutCone true && | |
161 | rm -rf repo/a repo/folder1 repo/folder2 && | |
96cc8ab5 DS |
162 | git -C repo read-tree -mu HEAD 2>err && |
163 | test_i18ngrep ! "disabling cone patterns" err && | |
879321eb | 164 | git -C repo reset --hard && |
522e6417 | 165 | check_files repo a folder1 folder2 |
879321eb DS |
166 | ' |
167 | ||
96cc8ab5 DS |
168 | test_expect_success 'cone mode: warn on bad pattern' ' |
169 | test_when_finished mv sparse-checkout repo/.git/info/ && | |
170 | cp repo/.git/info/sparse-checkout . && | |
171 | echo "!/deep/deeper/*" >>repo/.git/info/sparse-checkout && | |
172 | git -C repo read-tree -mu HEAD 2>err && | |
173 | test_i18ngrep "unrecognized negative pattern" err | |
174 | ' | |
175 | ||
72918c1a | 176 | test_expect_success 'sparse-checkout disable' ' |
99dfa6f9 | 177 | test_when_finished rm -rf repo/.git/info/sparse-checkout && |
72918c1a | 178 | git -C repo sparse-checkout disable && |
99dfa6f9 | 179 | test_path_is_file repo/.git/info/sparse-checkout && |
72918c1a DS |
180 | git -C repo config --list >config && |
181 | test_must_fail git config core.sparseCheckout && | |
522e6417 | 182 | check_files repo a deep folder1 folder2 |
72918c1a DS |
183 | ' |
184 | ||
af09ce24 DS |
185 | test_expect_success 'cone mode: init and set' ' |
186 | git -C repo sparse-checkout init --cone && | |
187 | git -C repo config --list >config && | |
188 | test_i18ngrep "core.sparsecheckoutcone=true" config && | |
761e3d26 | 189 | list_files repo >dir && |
af09ce24 DS |
190 | echo a >expect && |
191 | test_cmp expect dir && | |
192 | git -C repo sparse-checkout set deep/deeper1/deepest/ 2>err && | |
193 | test_must_be_empty err && | |
522e6417 DS |
194 | check_files repo a deep && |
195 | check_files repo/deep a deeper1 && | |
196 | check_files repo/deep/deeper1 a deepest && | |
d622c343 DS |
197 | cat >expect <<-\EOF && |
198 | /* | |
199 | !/*/ | |
200 | /deep/ | |
201 | !/deep/*/ | |
202 | /deep/deeper1/ | |
203 | !/deep/deeper1/*/ | |
204 | /deep/deeper1/deepest/ | |
af09ce24 DS |
205 | EOF |
206 | test_cmp expect repo/.git/info/sparse-checkout && | |
d622c343 DS |
207 | git -C repo sparse-checkout set --stdin 2>err <<-\EOF && |
208 | folder1 | |
209 | folder2 | |
af09ce24 DS |
210 | EOF |
211 | test_must_be_empty err && | |
522e6417 | 212 | check_files repo a folder1 folder2 |
af09ce24 DS |
213 | ' |
214 | ||
de11951b | 215 | test_expect_success 'cone mode: list' ' |
d622c343 DS |
216 | cat >expect <<-\EOF && |
217 | folder1 | |
218 | folder2 | |
de11951b DS |
219 | EOF |
220 | git -C repo sparse-checkout set --stdin <expect && | |
221 | git -C repo sparse-checkout list >actual 2>err && | |
222 | test_must_be_empty err && | |
223 | test_cmp expect actual | |
224 | ' | |
225 | ||
e9de487a DS |
226 | test_expect_success 'cone mode: set with nested folders' ' |
227 | git -C repo sparse-checkout set deep deep/deeper1/deepest 2>err && | |
228 | test_line_count = 0 err && | |
d622c343 DS |
229 | cat >expect <<-\EOF && |
230 | /* | |
231 | !/*/ | |
232 | /deep/ | |
e9de487a DS |
233 | EOF |
234 | test_cmp repo/.git/info/sparse-checkout expect | |
235 | ' | |
236 | ||
2631dc87 DS |
237 | test_expect_success 'cone mode: add independent path' ' |
238 | git -C repo sparse-checkout set deep/deeper1 && | |
239 | git -C repo sparse-checkout add folder1 && | |
240 | cat >expect <<-\EOF && | |
241 | /* | |
242 | !/*/ | |
243 | /deep/ | |
244 | !/deep/*/ | |
245 | /deep/deeper1/ | |
246 | /folder1/ | |
247 | EOF | |
248 | test_cmp expect repo/.git/info/sparse-checkout && | |
249 | check_files repo a deep folder1 | |
250 | ' | |
251 | ||
252 | test_expect_success 'cone mode: add sibling path' ' | |
253 | git -C repo sparse-checkout set deep/deeper1 && | |
254 | git -C repo sparse-checkout add deep/deeper2 && | |
255 | cat >expect <<-\EOF && | |
256 | /* | |
257 | !/*/ | |
258 | /deep/ | |
259 | !/deep/*/ | |
260 | /deep/deeper1/ | |
261 | /deep/deeper2/ | |
262 | EOF | |
263 | test_cmp expect repo/.git/info/sparse-checkout && | |
264 | check_files repo a deep | |
265 | ' | |
266 | ||
267 | test_expect_success 'cone mode: add parent path' ' | |
268 | git -C repo sparse-checkout set deep/deeper1 folder1 && | |
269 | git -C repo sparse-checkout add deep && | |
270 | cat >expect <<-\EOF && | |
271 | /* | |
272 | !/*/ | |
273 | /deep/ | |
274 | /folder1/ | |
275 | EOF | |
276 | test_cmp expect repo/.git/info/sparse-checkout && | |
277 | check_files repo a deep folder1 | |
278 | ' | |
279 | ||
f56f31af | 280 | test_expect_success 'not-up-to-date does not block rest of sparsification' ' |
72064ee5 | 281 | test_when_finished git -C repo sparse-checkout disable && |
cff4e913 | 282 | test_when_finished git -C repo reset --hard && |
2631dc87 | 283 | git -C repo sparse-checkout set deep && |
f56f31af | 284 | |
e091228e DS |
285 | echo update >repo/deep/deeper2/a && |
286 | cp repo/.git/info/sparse-checkout expect && | |
f56f31af EN |
287 | test_write_lines "!/deep/*/" "/deep/deeper1/" >>expect && |
288 | ||
289 | git -C repo sparse-checkout set deep/deeper1 2>err && | |
290 | ||
291 | test_i18ngrep "Cannot update sparse checkout" err && | |
292 | test_cmp expect repo/.git/info/sparse-checkout && | |
293 | check_files repo/deep a deeper1 deeper2 && | |
294 | check_files repo/deep/deeper1 a deepest && | |
295 | check_files repo/deep/deeper1/deepest a && | |
296 | check_files repo/deep/deeper2 a | |
e091228e DS |
297 | ' |
298 | ||
299 | test_expect_success 'revert to old sparse-checkout on empty update' ' | |
300 | git init empty-test && | |
301 | ( | |
302 | echo >file && | |
303 | git add file && | |
304 | git commit -m "test" && | |
305 | test_must_fail git sparse-checkout set nothing 2>err && | |
306 | test_i18ngrep "Sparse checkout leaves no entry on working directory" err && | |
307 | test_i18ngrep ! ".git/index.lock" err && | |
308 | git sparse-checkout set file | |
309 | ) | |
310 | ' | |
311 | ||
fb10ca5b DS |
312 | test_expect_success 'fail when lock is taken' ' |
313 | test_when_finished rm -rf repo/.git/info/sparse-checkout.lock && | |
314 | touch repo/.git/info/sparse-checkout.lock && | |
315 | test_must_fail git -C repo sparse-checkout set deep 2>err && | |
4605a730 | 316 | test_i18ngrep "Unable to create .*\.lock" err |
fb10ca5b DS |
317 | ' |
318 | ||
f75a69f8 DS |
319 | test_expect_success '.gitignore should not warn about cone mode' ' |
320 | git -C repo config --worktree core.sparseCheckoutCone true && | |
321 | echo "**/bin/*" >repo/.gitignore && | |
322 | git -C repo reset --hard 2>err && | |
323 | test_i18ngrep ! "disabling cone patterns" err | |
324 | ' | |
325 | ||
f56f31af | 326 | test_expect_success 'sparse-checkout (init|set|disable) warns with dirty status' ' |
cff4e913 DS |
327 | git clone repo dirty && |
328 | echo dirty >dirty/folder1/a && | |
f56f31af EN |
329 | |
330 | git -C dirty sparse-checkout init 2>err && | |
6271d77c | 331 | test_i18ngrep "warning.*Cannot update sparse checkout" err && |
f56f31af EN |
332 | |
333 | git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* 2>err && | |
6271d77c | 334 | test_i18ngrep "warning.*Cannot update sparse checkout" err && |
f56f31af EN |
335 | test_path_is_file dirty/folder1/a && |
336 | ||
337 | git -C dirty sparse-checkout disable 2>err && | |
338 | test_must_be_empty err && | |
339 | ||
cff4e913 DS |
340 | git -C dirty reset --hard && |
341 | git -C dirty sparse-checkout init && | |
342 | git -C dirty sparse-checkout set /folder2/* /deep/deeper1/* && | |
f56f31af EN |
343 | test_path_is_missing dirty/folder1/a && |
344 | git -C dirty sparse-checkout disable && | |
345 | test_path_is_file dirty/folder1/a | |
cff4e913 DS |
346 | ' |
347 | ||
190a65f9 | 348 | test_expect_success 'cone mode: set with core.ignoreCase=true' ' |
72064ee5 | 349 | rm repo/.git/info/sparse-checkout && |
190a65f9 DS |
350 | git -C repo sparse-checkout init --cone && |
351 | git -C repo -c core.ignoreCase=true sparse-checkout set folder1 && | |
d622c343 DS |
352 | cat >expect <<-\EOF && |
353 | /* | |
354 | !/*/ | |
355 | /folder1/ | |
190a65f9 DS |
356 | EOF |
357 | test_cmp expect repo/.git/info/sparse-checkout && | |
522e6417 | 358 | check_files repo a folder1 |
190a65f9 DS |
359 | ' |
360 | ||
4fd683b6 DS |
361 | test_expect_success 'interaction with submodules' ' |
362 | git clone repo super && | |
363 | ( | |
364 | cd super && | |
365 | mkdir modules && | |
366 | git submodule add ../repo modules/child && | |
367 | git add . && | |
368 | git commit -m "add submodule" && | |
369 | git sparse-checkout init --cone && | |
370 | git sparse-checkout set folder1 | |
371 | ) && | |
522e6417 DS |
372 | check_files super a folder1 modules && |
373 | check_files super/modules/child a deep folder1 folder2 | |
4fd683b6 DS |
374 | ' |
375 | ||
3c754067 DS |
376 | test_expect_success 'different sparse-checkouts with worktrees' ' |
377 | git -C repo worktree add --detach ../worktree && | |
378 | check_files worktree "a deep folder1 folder2" && | |
379 | git -C worktree sparse-checkout init --cone && | |
380 | git -C repo sparse-checkout set folder1 && | |
381 | git -C worktree sparse-checkout set deep/deeper1 && | |
382 | check_files repo a folder1 && | |
383 | check_files worktree a deep | |
384 | ' | |
385 | ||
f998a3f1 DS |
386 | test_expect_success 'set using filename keeps file on-disk' ' |
387 | git -C repo sparse-checkout set a deep && | |
388 | cat >expect <<-\EOF && | |
389 | /* | |
390 | !/*/ | |
391 | /a/ | |
392 | /deep/ | |
393 | EOF | |
394 | test_cmp expect repo/.git/info/sparse-checkout && | |
395 | check_files repo a deep | |
396 | ' | |
397 | ||
41de0c6f DS |
398 | check_read_tree_errors () { |
399 | REPO=$1 | |
400 | FILES=$2 | |
401 | ERRORS=$3 | |
d585f0e7 DS |
402 | git -C $REPO -c core.sparseCheckoutCone=false read-tree -mu HEAD 2>err && |
403 | test_must_be_empty err && | |
404 | check_files $REPO "$FILES" && | |
41de0c6f DS |
405 | git -C $REPO read-tree -mu HEAD 2>err && |
406 | if test -z "$ERRORS" | |
407 | then | |
408 | test_must_be_empty err | |
409 | else | |
410 | test_i18ngrep "$ERRORS" err | |
411 | fi && | |
412 | check_files $REPO $FILES | |
413 | } | |
414 | ||
415 | test_expect_success 'pattern-checks: /A/**' ' | |
416 | cat >repo/.git/info/sparse-checkout <<-\EOF && | |
417 | /* | |
418 | !/*/ | |
419 | /folder1/** | |
420 | EOF | |
421 | check_read_tree_errors repo "a folder1" "disabling cone pattern matching" | |
422 | ' | |
423 | ||
424 | test_expect_success 'pattern-checks: /A/**/B/' ' | |
425 | cat >repo/.git/info/sparse-checkout <<-\EOF && | |
426 | /* | |
427 | !/*/ | |
428 | /deep/**/deepest | |
429 | EOF | |
430 | check_read_tree_errors repo "a deep" "disabling cone pattern matching" && | |
431 | check_files repo/deep "deeper1" && | |
432 | check_files repo/deep/deeper1 "deepest" | |
433 | ' | |
434 | ||
9e6d3e64 DS |
435 | test_expect_success 'pattern-checks: too short' ' |
436 | cat >repo/.git/info/sparse-checkout <<-\EOF && | |
437 | /* | |
438 | !/*/ | |
6c11c6a1 | 439 | / |
9e6d3e64 DS |
440 | EOF |
441 | check_read_tree_errors repo "a" "disabling cone pattern matching" | |
442 | ' | |
6c11c6a1 DS |
443 | test_expect_success 'pattern-checks: not too short' ' |
444 | cat >repo/.git/info/sparse-checkout <<-\EOF && | |
445 | /* | |
446 | !/*/ | |
447 | /b/ | |
448 | EOF | |
449 | git -C repo read-tree -mu HEAD 2>err && | |
450 | test_must_be_empty err && | |
451 | check_files repo a | |
452 | ' | |
9e6d3e64 | 453 | |
9abc60f8 DS |
454 | test_expect_success 'pattern-checks: trailing "*"' ' |
455 | cat >repo/.git/info/sparse-checkout <<-\EOF && | |
456 | /* | |
457 | !/*/ | |
458 | /a* | |
459 | EOF | |
460 | check_read_tree_errors repo "a" "disabling cone pattern matching" | |
461 | ' | |
462 | ||
463 | test_expect_success 'pattern-checks: starting "*"' ' | |
464 | cat >repo/.git/info/sparse-checkout <<-\EOF && | |
465 | /* | |
466 | !/*/ | |
467 | *eep/ | |
468 | EOF | |
469 | check_read_tree_errors repo "a deep" "disabling cone pattern matching" | |
470 | ' | |
471 | ||
472 | test_expect_success 'pattern-checks: contained glob characters' ' | |
473 | for c in "[a]" "\\" "?" "*" | |
474 | do | |
475 | cat >repo/.git/info/sparse-checkout <<-EOF && | |
476 | /* | |
477 | !/*/ | |
478 | something$c-else/ | |
479 | EOF | |
480 | check_read_tree_errors repo "a" "disabling cone pattern matching" | |
481 | done | |
482 | ' | |
483 | ||
e53ffe27 | 484 | test_expect_success BSLASHPSPEC 'pattern-checks: escaped characters' ' |
4f52c2ce DS |
485 | git clone repo escaped && |
486 | TREEOID=$(git -C escaped rev-parse HEAD:folder1) && | |
487 | NEWTREE=$(git -C escaped mktree <<-EOF | |
488 | $(git -C escaped ls-tree HEAD) | |
489 | 040000 tree $TREEOID zbad\\dir | |
490 | 040000 tree $TREEOID zdoes*exist | |
e53ffe27 | 491 | 040000 tree $TREEOID zglob[!a]? |
4f52c2ce DS |
492 | EOF |
493 | ) && | |
494 | COMMIT=$(git -C escaped commit-tree $NEWTREE -p HEAD) && | |
495 | git -C escaped reset --hard $COMMIT && | |
e53ffe27 | 496 | check_files escaped "a deep folder1 folder2 zbad\\dir zdoes*exist" zglob[!a]? && |
4f52c2ce | 497 | git -C escaped sparse-checkout init --cone && |
e53ffe27 | 498 | git -C escaped sparse-checkout set zbad\\dir/bogus "zdoes*not*exist" "zdoes*exist" "zglob[!a]?" && |
d585f0e7 | 499 | cat >expect <<-\EOF && |
9abc60f8 DS |
500 | /* |
501 | !/*/ | |
4f52c2ce DS |
502 | /zbad\\dir/ |
503 | !/zbad\\dir/*/ | |
d585f0e7 | 504 | /zbad\\dir/bogus/ |
4f52c2ce | 505 | /zdoes\*exist/ |
d585f0e7 | 506 | /zdoes\*not\*exist/ |
e53ffe27 | 507 | /zglob\[!a]\?/ |
9abc60f8 | 508 | EOF |
d585f0e7 | 509 | test_cmp expect escaped/.git/info/sparse-checkout && |
e53ffe27 | 510 | check_read_tree_errors escaped "a zbad\\dir zdoes*exist zglob[!a]?" && |
e55682ea DS |
511 | git -C escaped ls-tree -d --name-only HEAD >list-expect && |
512 | git -C escaped sparse-checkout set --stdin <list-expect && | |
bd64de42 DS |
513 | cat >expect <<-\EOF && |
514 | /* | |
515 | !/*/ | |
516 | /deep/ | |
517 | /folder1/ | |
518 | /folder2/ | |
519 | /zbad\\dir/ | |
520 | /zdoes\*exist/ | |
e53ffe27 | 521 | /zglob\[!a]\?/ |
bd64de42 DS |
522 | EOF |
523 | test_cmp expect escaped/.git/info/sparse-checkout && | |
e53ffe27 | 524 | check_files escaped "a deep folder1 folder2 zbad\\dir zdoes*exist" zglob[!a]? && |
e55682ea DS |
525 | git -C escaped sparse-checkout list >list-actual && |
526 | test_cmp list-expect list-actual | |
9abc60f8 DS |
527 | ' |
528 | ||
ef076599 DS |
529 | test_expect_success MINGW 'cone mode replaces backslashes with slashes' ' |
530 | git -C repo sparse-checkout set deep\\deeper1 && | |
531 | cat >expect <<-\EOF && | |
532 | /* | |
533 | !/*/ | |
534 | /deep/ | |
535 | !/deep/*/ | |
536 | /deep/deeper1/ | |
537 | EOF | |
538 | test_cmp expect repo/.git/info/sparse-checkout && | |
539 | check_files repo a deep && | |
540 | check_files repo/deep a deeper1 | |
541 | ' | |
542 | ||
94c0956b | 543 | test_done |