ci: use upload-artifacts v1 for dockerized jobs
[git/debian.git] / t / t1092-sparse-checkout-compatibility.sh
blob91e30d6ec2248a88b58752d30cb2f72f79ee92c9
1 #!/bin/sh
3 test_description='compare full workdir to sparse workdir'
5 GIT_TEST_SPLIT_INDEX=0
6 GIT_TEST_SPARSE_INDEX=
8 . ./test-lib.sh
10 test_expect_success 'setup' '
11 git init initial-repo &&
13 GIT_TEST_SPARSE_INDEX=0 &&
14 cd initial-repo &&
15 echo a >a &&
16 echo "after deep" >e &&
17 echo "after folder1" >g &&
18 echo "after x" >z &&
19 mkdir folder1 folder2 deep x &&
20 mkdir deep/deeper1 deep/deeper2 deep/before deep/later &&
21 mkdir deep/deeper1/deepest &&
22 echo "after deeper1" >deep/e &&
23 echo "after deepest" >deep/deeper1/e &&
24 cp a folder1 &&
25 cp a folder2 &&
26 cp a x &&
27 cp a deep &&
28 cp a deep/before &&
29 cp a deep/deeper1 &&
30 cp a deep/deeper2 &&
31 cp a deep/later &&
32 cp a deep/deeper1/deepest &&
33 cp -r deep/deeper1/deepest deep/deeper2 &&
34 mkdir deep/deeper1/0 &&
35 mkdir deep/deeper1/0/0 &&
36 touch deep/deeper1/0/1 &&
37 touch deep/deeper1/0/0/0 &&
38 >folder1- &&
39 >folder1.x &&
40 >folder10 &&
41 cp -r deep/deeper1/0 folder1 &&
42 cp -r deep/deeper1/0 folder2 &&
43 echo >>folder1/0/0/0 &&
44 echo >>folder2/0/1 &&
45 git add . &&
46 git commit -m "initial commit" &&
47 git checkout -b base &&
48 for dir in folder1 folder2 deep
50 git checkout -b update-$dir &&
51 echo "updated $dir" >$dir/a &&
52 git commit -a -m "update $dir" || return 1
53 done &&
55 git checkout -b rename-base base &&
56 cat >folder1/larger-content <<-\EOF &&
57 matching
58 lines
59 help
60 inexact
61 renames
62 EOF
63 cp folder1/larger-content folder2/ &&
64 cp folder1/larger-content deep/deeper1/ &&
65 git add . &&
66 git commit -m "add interesting rename content" &&
68 git checkout -b rename-out-to-out rename-base &&
69 mv folder1/a folder2/b &&
70 mv folder1/larger-content folder2/edited-content &&
71 echo >>folder2/edited-content &&
72 echo >>folder2/0/1 &&
73 echo stuff >>deep/deeper1/a &&
74 git add . &&
75 git commit -m "rename folder1/... to folder2/..." &&
77 git checkout -b rename-out-to-in rename-base &&
78 mv folder1/a deep/deeper1/b &&
79 echo more stuff >>deep/deeper1/a &&
80 rm folder2/0/1 &&
81 mkdir folder2/0/1 &&
82 echo >>folder2/0/1/1 &&
83 mv folder1/larger-content deep/deeper1/edited-content &&
84 echo >>deep/deeper1/edited-content &&
85 git add . &&
86 git commit -m "rename folder1/... to deep/deeper1/..." &&
88 git checkout -b rename-in-to-out rename-base &&
89 mv deep/deeper1/a folder1/b &&
90 echo >>folder2/0/1 &&
91 rm -rf folder1/0/0 &&
92 echo >>folder1/0/0 &&
93 mv deep/deeper1/larger-content folder1/edited-content &&
94 echo >>folder1/edited-content &&
95 git add . &&
96 git commit -m "rename deep/deeper1/... to folder1/..." &&
98 git checkout -b df-conflict-1 base &&
99 rm -rf folder1 &&
100 echo content >folder1 &&
101 git add . &&
102 git commit -m "dir to file" &&
104 git checkout -b df-conflict-2 base &&
105 rm -rf folder2 &&
106 echo content >folder2 &&
107 git add . &&
108 git commit -m "dir to file" &&
110 git checkout -b fd-conflict base &&
111 rm a &&
112 mkdir a &&
113 echo content >a/a &&
114 git add . &&
115 git commit -m "file to dir" &&
117 git checkout -b deepest base &&
118 echo "updated deepest" >deep/deeper1/deepest/a &&
119 git commit -a -m "update deepest" &&
121 git checkout -f base &&
122 git reset --hard
126 init_repos () {
127 rm -rf full-checkout sparse-checkout sparse-index &&
129 # create repos in initial state
130 cp -r initial-repo full-checkout &&
131 git -C full-checkout reset --hard &&
133 cp -r initial-repo sparse-checkout &&
134 git -C sparse-checkout reset --hard &&
136 cp -r initial-repo sparse-index &&
137 git -C sparse-index reset --hard &&
139 # initialize sparse-checkout definitions
140 git -C sparse-checkout sparse-checkout init --cone &&
141 git -C sparse-checkout sparse-checkout set deep &&
142 git -C sparse-index sparse-checkout init --cone --sparse-index &&
143 test_cmp_config -C sparse-index true index.sparse &&
144 git -C sparse-index sparse-checkout set deep
147 run_on_sparse () {
149 cd sparse-checkout &&
150 GIT_PROGRESS_DELAY=100000 "$@" >../sparse-checkout-out 2>../sparse-checkout-err
151 ) &&
153 cd sparse-index &&
154 GIT_PROGRESS_DELAY=100000 "$@" >../sparse-index-out 2>../sparse-index-err
158 run_on_all () {
160 cd full-checkout &&
161 GIT_PROGRESS_DELAY=100000 "$@" >../full-checkout-out 2>../full-checkout-err
162 ) &&
163 run_on_sparse "$@"
166 test_all_match () {
167 run_on_all "$@" &&
168 test_cmp full-checkout-out sparse-checkout-out &&
169 test_cmp full-checkout-out sparse-index-out &&
170 test_cmp full-checkout-err sparse-checkout-err &&
171 test_cmp full-checkout-err sparse-index-err
174 test_sparse_match () {
175 run_on_sparse "$@" &&
176 test_cmp sparse-checkout-out sparse-index-out &&
177 test_cmp sparse-checkout-err sparse-index-err
180 test_expect_success 'sparse-index contents' '
181 init_repos &&
183 test-tool -C sparse-index read-cache --table >cache &&
184 for dir in folder1 folder2 x
186 TREE=$(git -C sparse-index rev-parse HEAD:$dir) &&
187 grep "040000 tree $TREE $dir/" cache \
188 || return 1
189 done &&
191 git -C sparse-index sparse-checkout set folder1 &&
193 test-tool -C sparse-index read-cache --table >cache &&
194 for dir in deep folder2 x
196 TREE=$(git -C sparse-index rev-parse HEAD:$dir) &&
197 grep "040000 tree $TREE $dir/" cache \
198 || return 1
199 done &&
201 git -C sparse-index sparse-checkout set deep/deeper1 &&
203 test-tool -C sparse-index read-cache --table >cache &&
204 for dir in deep/deeper2 folder1 folder2 x
206 TREE=$(git -C sparse-index rev-parse HEAD:$dir) &&
207 grep "040000 tree $TREE $dir/" cache \
208 || return 1
209 done &&
211 # Disabling the sparse-index removes tree entries with full ones
212 git -C sparse-index sparse-checkout init --no-sparse-index &&
214 test-tool -C sparse-index read-cache --table >cache &&
215 ! grep "040000 tree" cache &&
216 test_sparse_match test-tool read-cache --table
219 test_expect_success 'expanded in-memory index matches full index' '
220 init_repos &&
221 test_sparse_match test-tool read-cache --expand --table
224 test_expect_success 'status with options' '
225 init_repos &&
226 test_sparse_match ls &&
227 test_all_match git status --porcelain=v2 &&
228 test_all_match git status --porcelain=v2 -z -u &&
229 test_all_match git status --porcelain=v2 -uno &&
230 run_on_all touch README.md &&
231 test_all_match git status --porcelain=v2 &&
232 test_all_match git status --porcelain=v2 -z -u &&
233 test_all_match git status --porcelain=v2 -uno &&
234 test_all_match git add README.md &&
235 test_all_match git status --porcelain=v2 &&
236 test_all_match git status --porcelain=v2 -z -u &&
237 test_all_match git status --porcelain=v2 -uno
240 test_expect_success 'status reports sparse-checkout' '
241 init_repos &&
242 git -C sparse-checkout status >full &&
243 git -C sparse-index status >sparse &&
244 test_i18ngrep "You are in a sparse checkout with " full &&
245 test_i18ngrep "You are in a sparse checkout." sparse
248 test_expect_success 'add, commit, checkout' '
249 init_repos &&
251 write_script edit-contents <<-\EOF &&
252 echo text >>$1
254 run_on_all ../edit-contents README.md &&
256 test_all_match git add README.md &&
257 test_all_match git status --porcelain=v2 &&
258 test_all_match git commit -m "Add README.md" &&
260 test_all_match git checkout HEAD~1 &&
261 test_all_match git checkout - &&
263 run_on_all ../edit-contents README.md &&
265 test_all_match git add -A &&
266 test_all_match git status --porcelain=v2 &&
267 test_all_match git commit -m "Extend README.md" &&
269 test_all_match git checkout HEAD~1 &&
270 test_all_match git checkout - &&
272 run_on_all ../edit-contents deep/newfile &&
274 test_all_match git status --porcelain=v2 -uno &&
275 test_all_match git status --porcelain=v2 &&
276 test_all_match git add . &&
277 test_all_match git status --porcelain=v2 &&
278 test_all_match git commit -m "add deep/newfile" &&
280 test_all_match git checkout HEAD~1 &&
281 test_all_match git checkout -
284 test_expect_success 'commit including unstaged changes' '
285 init_repos &&
287 write_script edit-file <<-\EOF &&
288 echo $1 >$2
291 run_on_all ../edit-file 1 a &&
292 run_on_all ../edit-file 1 deep/a &&
294 test_all_match git commit -m "-a" -a &&
295 test_all_match git status --porcelain=v2 &&
297 run_on_all ../edit-file 2 a &&
298 run_on_all ../edit-file 2 deep/a &&
300 test_all_match git commit -m "--include" --include deep/a &&
301 test_all_match git status --porcelain=v2 &&
302 test_all_match git commit -m "--include" --include a &&
303 test_all_match git status --porcelain=v2 &&
305 run_on_all ../edit-file 3 a &&
306 run_on_all ../edit-file 3 deep/a &&
308 test_all_match git commit -m "--amend" -a --amend &&
309 test_all_match git status --porcelain=v2
312 test_expect_success 'status/add: outside sparse cone' '
313 init_repos &&
315 # adding a "missing" file outside the cone should fail
316 test_sparse_match test_must_fail git add folder1/a &&
318 # folder1 is at HEAD, but outside the sparse cone
319 run_on_sparse mkdir folder1 &&
320 cp initial-repo/folder1/a sparse-checkout/folder1/a &&
321 cp initial-repo/folder1/a sparse-index/folder1/a &&
323 test_sparse_match git status &&
325 write_script edit-contents <<-\EOF &&
326 echo text >>$1
328 run_on_sparse ../edit-contents folder1/a &&
329 run_on_all ../edit-contents folder1/new &&
331 test_sparse_match git status --porcelain=v2 &&
333 # This "git add folder1/a" fails with a warning
334 # in the sparse repos, differing from the full
335 # repo. This is intentional.
336 test_sparse_match test_must_fail git add folder1/a &&
337 test_sparse_match test_must_fail git add --refresh folder1/a &&
338 test_all_match git status --porcelain=v2 &&
340 test_all_match git add . &&
341 test_all_match git status --porcelain=v2 &&
342 test_all_match git commit -m folder1/new &&
344 run_on_all ../edit-contents folder1/newer &&
345 test_all_match git add folder1/ &&
346 test_all_match git status --porcelain=v2 &&
347 test_all_match git commit -m folder1/newer
350 test_expect_success 'checkout and reset --hard' '
351 init_repos &&
353 test_all_match git checkout update-folder1 &&
354 test_all_match git status --porcelain=v2 &&
356 test_all_match git checkout update-deep &&
357 test_all_match git status --porcelain=v2 &&
359 test_all_match git checkout -b reset-test &&
360 test_all_match git reset --hard deepest &&
361 test_all_match git reset --hard update-folder1 &&
362 test_all_match git reset --hard update-folder2
365 test_expect_success 'diff --staged' '
366 init_repos &&
368 write_script edit-contents <<-\EOF &&
369 echo text >>README.md
371 run_on_all ../edit-contents &&
373 test_all_match git diff &&
374 test_all_match git diff --staged &&
375 test_all_match git add README.md &&
376 test_all_match git diff &&
377 test_all_match git diff --staged
380 # NEEDSWORK: sparse-checkout behaves differently from full-checkout when
381 # running this test with 'df-conflict-2' after 'df-conflict-1'.
382 test_expect_success 'diff with renames and conflicts' '
383 init_repos &&
385 for branch in rename-out-to-out \
386 rename-out-to-in \
387 rename-in-to-out \
388 df-conflict-1 \
389 fd-conflict
391 test_all_match git checkout rename-base &&
392 test_all_match git checkout $branch -- . &&
393 test_all_match git status --porcelain=v2 &&
394 test_all_match git diff --staged --no-renames &&
395 test_all_match git diff --staged --find-renames || return 1
396 done
399 test_expect_success 'diff with directory/file conflicts' '
400 init_repos &&
402 for branch in rename-out-to-out \
403 rename-out-to-in \
404 rename-in-to-out \
405 df-conflict-1 \
406 df-conflict-2 \
407 fd-conflict
409 git -C full-checkout reset --hard &&
410 test_sparse_match git reset --hard &&
411 test_all_match git checkout $branch &&
412 test_all_match git checkout rename-base -- . &&
413 test_all_match git status --porcelain=v2 &&
414 test_all_match git diff --staged --no-renames &&
415 test_all_match git diff --staged --find-renames || return 1
416 done
419 test_expect_success 'log with pathspec outside sparse definition' '
420 init_repos &&
422 test_all_match git log -- a &&
423 test_all_match git log -- folder1/a &&
424 test_all_match git log -- folder2/a &&
425 test_all_match git log -- deep/a &&
426 test_all_match git log -- deep/deeper1/a &&
427 test_all_match git log -- deep/deeper1/deepest/a &&
429 test_all_match git checkout update-folder1 &&
430 test_all_match git log -- folder1/a
433 test_expect_success 'blame with pathspec inside sparse definition' '
434 init_repos &&
436 test_all_match git blame a &&
437 test_all_match git blame deep/a &&
438 test_all_match git blame deep/deeper1/a &&
439 test_all_match git blame deep/deeper1/deepest/a
442 # TODO: blame currently does not support blaming files outside of the
443 # sparse definition. It complains that the file doesn't exist locally.
444 test_expect_failure 'blame with pathspec outside sparse definition' '
445 init_repos &&
447 test_all_match git blame folder1/a &&
448 test_all_match git blame folder2/a &&
449 test_all_match git blame deep/deeper2/a &&
450 test_all_match git blame deep/deeper2/deepest/a
453 # NEEDSWORK: a sparse-checkout behaves differently from a full checkout
454 # in this scenario, but it shouldn't.
455 test_expect_failure 'checkout and reset (mixed)' '
456 init_repos &&
458 test_all_match git checkout -b reset-test update-deep &&
459 test_all_match git reset deepest &&
460 test_all_match git reset update-folder1 &&
461 test_all_match git reset update-folder2
464 # NEEDSWORK: a sparse-checkout behaves differently from a full checkout
465 # in this scenario, but it shouldn't.
466 test_expect_success 'checkout and reset (mixed) [sparse]' '
467 init_repos &&
469 test_sparse_match git checkout -b reset-test update-deep &&
470 test_sparse_match git reset deepest &&
471 test_sparse_match git reset update-folder1 &&
472 test_sparse_match git reset update-folder2
475 test_expect_success 'merge' '
476 init_repos &&
478 test_all_match git checkout -b merge update-deep &&
479 test_all_match git merge -m "folder1" update-folder1 &&
480 test_all_match git rev-parse HEAD^{tree} &&
481 test_all_match git merge -m "folder2" update-folder2 &&
482 test_all_match git rev-parse HEAD^{tree}
485 test_expect_success 'merge with outside renames' '
486 init_repos &&
488 for type in out-to-out out-to-in in-to-out
490 test_all_match git reset --hard &&
491 test_all_match git checkout -f -b merge-$type update-deep &&
492 test_all_match git merge -m "$type" rename-$type &&
493 test_all_match git rev-parse HEAD^{tree} || return 1
494 done
497 # Sparse-index fails to convert the index in the
498 # final 'git cherry-pick' command.
499 test_expect_success 'cherry-pick with conflicts' '
500 init_repos &&
502 write_script edit-conflict <<-\EOF &&
503 echo $1 >conflict
506 test_all_match git checkout -b to-cherry-pick &&
507 run_on_all ../edit-conflict ABC &&
508 test_all_match git add conflict &&
509 test_all_match git commit -m "conflict to pick" &&
511 test_all_match git checkout -B base HEAD~1 &&
512 run_on_all ../edit-conflict DEF &&
513 test_all_match git add conflict &&
514 test_all_match git commit -m "conflict in base" &&
516 test_all_match test_must_fail git cherry-pick to-cherry-pick
519 test_expect_success 'clean' '
520 init_repos &&
522 echo bogus >>.gitignore &&
523 run_on_all cp ../.gitignore . &&
524 test_all_match git add .gitignore &&
525 test_all_match git commit -m "ignore bogus files" &&
527 run_on_sparse mkdir folder1 &&
528 run_on_all touch folder1/bogus &&
530 test_all_match git status --porcelain=v2 &&
531 test_all_match git clean -f &&
532 test_all_match git status --porcelain=v2 &&
533 test_sparse_match ls &&
534 test_sparse_match ls folder1 &&
536 test_all_match git clean -xf &&
537 test_all_match git status --porcelain=v2 &&
538 test_sparse_match ls &&
539 test_sparse_match ls folder1 &&
541 test_all_match git clean -xdf &&
542 test_all_match git status --porcelain=v2 &&
543 test_sparse_match ls &&
544 test_sparse_match ls folder1 &&
546 test_sparse_match test_path_is_dir folder1
549 test_expect_success 'submodule handling' '
550 init_repos &&
552 test_all_match mkdir modules &&
553 test_all_match touch modules/a &&
554 test_all_match git add modules &&
555 test_all_match git commit -m "add modules directory" &&
557 run_on_all git submodule add "$(pwd)/initial-repo" modules/sub &&
558 test_all_match git commit -m "add submodule" &&
560 # having a submodule prevents "modules" from collapse
561 test-tool -C sparse-index read-cache --table >cache &&
562 grep "100644 blob .* modules/a" cache &&
563 grep "160000 commit $(git -C initial-repo rev-parse HEAD) modules/sub" cache
566 test_expect_success 'sparse-index is expanded and converted back' '
567 init_repos &&
569 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
570 git -C sparse-index -c core.fsmonitor="" reset --hard &&
571 test_region index convert_to_sparse trace2.txt &&
572 test_region index ensure_full_index trace2.txt
575 ensure_not_expanded () {
576 rm -f trace2.txt &&
577 echo >>sparse-index/untracked.txt &&
578 GIT_TRACE2_EVENT="$(pwd)/trace2.txt" GIT_TRACE2_EVENT_NESTING=10 \
579 git -C sparse-index "$@" &&
580 test_region ! index ensure_full_index trace2.txt
583 test_expect_success 'sparse-index is not expanded' '
584 init_repos &&
586 ensure_not_expanded status &&
587 ensure_not_expanded commit --allow-empty -m empty &&
588 echo >>sparse-index/a &&
589 ensure_not_expanded commit -a -m a &&
590 echo >>sparse-index/a &&
591 ensure_not_expanded commit --include a -m a &&
592 echo >>sparse-index/deep/deeper1/a &&
593 ensure_not_expanded commit --include deep/deeper1/a -m deeper &&
594 ensure_not_expanded checkout rename-out-to-out &&
595 ensure_not_expanded checkout - &&
596 ensure_not_expanded switch rename-out-to-out &&
597 ensure_not_expanded switch - &&
598 git -C sparse-index reset --hard &&
599 ensure_not_expanded checkout rename-out-to-out -- deep/deeper1 &&
600 git -C sparse-index reset --hard &&
601 ensure_not_expanded restore -s rename-out-to-out -- deep/deeper1
604 # NEEDSWORK: a sparse-checkout behaves differently from a full checkout
605 # in this scenario, but it shouldn't.
606 test_expect_success 'reset mixed and checkout orphan' '
607 init_repos &&
609 test_all_match git checkout rename-out-to-in &&
611 # Sparse checkouts do not agree with full checkouts about
612 # how to report a directory/file conflict during a reset.
613 # This command would fail with test_all_match because the
614 # full checkout reports "T folder1/0/1" while a sparse
615 # checkout reports "D folder1/0/1". This matches because
616 # the sparse checkouts skip "adding" the other side of
617 # the conflict.
618 test_sparse_match git reset --mixed HEAD~1 &&
619 test_sparse_match test-tool read-cache --table --expand &&
620 test_sparse_match git status --porcelain=v2 &&
622 # At this point, sparse-checkouts behave differently
623 # from the full-checkout.
624 test_sparse_match git checkout --orphan new-branch &&
625 test_sparse_match test-tool read-cache --table --expand &&
626 test_sparse_match git status --porcelain=v2
629 test_expect_success 'add everything with deep new file' '
630 init_repos &&
632 run_on_sparse git sparse-checkout set deep/deeper1/deepest &&
634 run_on_all touch deep/deeper1/x &&
635 test_all_match git add . &&
636 test_all_match git status --porcelain=v2
639 # NEEDSWORK: 'git checkout' behaves incorrectly in the case of
640 # directory/file conflicts, even without sparse-checkout. Use this
641 # test only as a documentation of the incorrect behavior, not a
642 # measure of how it _should_ behave.
643 test_expect_success 'checkout behaves oddly with df-conflict-1' '
644 init_repos &&
646 test_sparse_match git sparse-checkout disable &&
648 write_script edit-content <<-\EOF &&
649 echo content >>folder1/larger-content
650 git add folder1
653 run_on_all ../edit-content &&
654 test_all_match git status --porcelain=v2 &&
656 git -C sparse-checkout sparse-checkout init --cone &&
657 git -C sparse-index sparse-checkout init --cone --sparse-index &&
659 test_all_match git status --porcelain=v2 &&
661 # This checkout command should fail, because we have a staged
662 # change to folder1/larger-content, but the destination changes
663 # folder1 to a file.
664 git -C full-checkout checkout df-conflict-1 \
665 1>full-checkout-out \
666 2>full-checkout-err &&
667 git -C sparse-checkout checkout df-conflict-1 \
668 1>sparse-checkout-out \
669 2>sparse-checkout-err &&
670 git -C sparse-index checkout df-conflict-1 \
671 1>sparse-index-out \
672 2>sparse-index-err &&
674 # Instead, the checkout deletes the folder1 file and adds the
675 # folder1/larger-content file, leaving all other paths that were
676 # in folder1/ as deleted (without any warning).
677 cat >expect <<-EOF &&
678 D folder1
679 A folder1/larger-content
681 test_cmp expect full-checkout-out &&
682 test_cmp expect sparse-checkout-out &&
684 # The sparse-index reports no output
685 test_must_be_empty sparse-index-out &&
687 # stderr: Switched to branch df-conflict-1
688 test_cmp full-checkout-err sparse-checkout-err &&
689 test_cmp full-checkout-err sparse-checkout-err
692 # NEEDSWORK: 'git checkout' behaves incorrectly in the case of
693 # directory/file conflicts, even without sparse-checkout. Use this
694 # test only as a documentation of the incorrect behavior, not a
695 # measure of how it _should_ behave.
696 test_expect_success 'checkout behaves oddly with df-conflict-2' '
697 init_repos &&
699 test_sparse_match git sparse-checkout disable &&
701 write_script edit-content <<-\EOF &&
702 echo content >>folder2/larger-content
703 git add folder2
706 run_on_all ../edit-content &&
707 test_all_match git status --porcelain=v2 &&
709 git -C sparse-checkout sparse-checkout init --cone &&
710 git -C sparse-index sparse-checkout init --cone --sparse-index &&
712 test_all_match git status --porcelain=v2 &&
714 # This checkout command should fail, because we have a staged
715 # change to folder1/larger-content, but the destination changes
716 # folder1 to a file.
717 git -C full-checkout checkout df-conflict-2 \
718 1>full-checkout-out \
719 2>full-checkout-err &&
720 git -C sparse-checkout checkout df-conflict-2 \
721 1>sparse-checkout-out \
722 2>sparse-checkout-err &&
723 git -C sparse-index checkout df-conflict-2 \
724 1>sparse-index-out \
725 2>sparse-index-err &&
727 # The full checkout deviates from the df-conflict-1 case here!
728 # It drops the change to folder1/larger-content and leaves the
729 # folder1 path as-is on disk. The sparse-index behaves the same.
730 test_must_be_empty full-checkout-out &&
731 test_must_be_empty sparse-index-out &&
733 # In the sparse-checkout case, the checkout deletes the folder1
734 # file and adds the folder1/larger-content file, leaving all other
735 # paths that were in folder1/ as deleted (without any warning).
736 cat >expect <<-EOF &&
737 D folder2
738 A folder2/larger-content
740 test_cmp expect sparse-checkout-out &&
742 # Switched to branch df-conflict-1
743 test_cmp full-checkout-err sparse-checkout-err &&
744 test_cmp full-checkout-err sparse-index-err
747 test_done