@@ -528,51 +528,17 @@ test_expect_success 'blame with pathspec outside sparse definition' '
528
528
test_sparse_match test_must_fail git blame deep/deeper2/deepest/a
529
529
'
530
530
531
- # TODO: This behaves correctly in microsoft/git. Why?
532
531
test_expect_success ' checkout and reset (mixed)' '
533
532
init_repos &&
534
533
535
534
test_all_match git checkout -b reset-test update-deep &&
536
535
test_all_match git reset deepest &&
537
- test_all_match git reset update-folder1 &&
538
- test_all_match git reset update-folder2
539
- '
540
-
541
- # NEEDSWORK: a sparse-checkout behaves differently from a full checkout
542
- # in this scenario, but it shouldn't.
543
- test_expect_success ' checkout and reset (mixed) [sparse]' '
544
- init_repos &&
545
536
546
- test_sparse_match git checkout -b reset-test update-deep &&
547
- test_sparse_match git reset deepest &&
537
+ # Because skip-worktree is preserved, resetting to update-folder1
538
+ # will show worktree changes for full-checkout that are not present
539
+ # in sparse-checkout or sparse-index.
548
540
test_sparse_match git reset update-folder1 &&
549
- test_sparse_match git reset update-folder2
550
- '
551
-
552
- # NEEDSWORK: with mixed reset, files with differences between HEAD and <commit>
553
- # will be added to the work tree even if outside the sparse checkout
554
- # definition, and even if the file is modified to a state of having no local
555
- # changes. The file is "re-ignored" if a hard reset is executed. We may want to
556
- # change this behavior in the future and enforce that files are not written
557
- # outside of the sparse checkout definition.
558
- test_expect_success ' checkout and mixed reset file tracking [sparse]' '
559
- init_repos &&
560
-
561
- test_all_match git checkout -b reset-test update-deep &&
562
- test_all_match git reset update-folder1 &&
563
- test_all_match git reset update-deep &&
564
-
565
- # At this point, there are no changes in the working tree. However,
566
- # folder1/a now exists locally (even though it is outside of the sparse
567
- # paths).
568
- run_on_sparse test_path_exists folder1 &&
569
-
570
- run_on_all rm folder1/a &&
571
- test_all_match git status --porcelain=v2 &&
572
-
573
- test_all_match git reset --hard update-deep &&
574
- run_on_sparse test_path_is_missing folder1 &&
575
- test_path_exists full-checkout/folder1
541
+ run_on_sparse test_path_is_missing folder1
576
542
'
577
543
578
544
test_expect_success ' checkout and reset (merge)' '
@@ -629,31 +595,34 @@ test_expect_success 'reset with pathspecs inside sparse definition' '
629
595
test_all_match git status --porcelain=v2
630
596
'
631
597
632
- test_expect_success ' reset with sparse directory pathspec outside definition' '
598
+ # Although the working tree differs between full and sparse checkouts after
599
+ # reset, the state of the index is the same.
600
+ test_expect_success ' reset with pathspecs outside sparse definition' '
633
601
init_repos &&
602
+ test_all_match git checkout -b reset-test base &&
634
603
635
- test_all_match git checkout -b reset-test update-deep &&
636
- test_all_match git reset --hard update-folder1 &&
637
- test_all_match git reset base -- folder1 &&
638
- test_all_match git status --porcelain=v2
639
- '
640
-
641
- test_expect_success ' reset with pathspec match in sparse directory' '
642
- init_repos &&
604
+ test_sparse_match git reset update-folder1 -- folder1 &&
605
+ git -C full-checkout reset update-folder1 -- folder1 &&
606
+ test_sparse_match git status --porcelain=v2 &&
607
+ test_all_match git rev-parse HEAD:folder1 &&
643
608
644
- test_all_match git checkout -b reset-test update-deep &&
645
- test_all_match git reset --hard update-folder1 &&
646
- test_all_match git reset base -- folder1/a &&
647
- test_all_match git status --porcelain=v2
609
+ test_sparse_match git reset update-folder2 -- folder2/a &&
610
+ git -C full-checkout reset update-folder2 -- folder2/a &&
611
+ test_sparse_match git status --porcelain=v2 &&
612
+ test_all_match git rev-parse HEAD:folder2/a
648
613
'
649
614
650
615
test_expect_success ' reset with wildcard pathspec' '
651
616
init_repos &&
652
617
653
618
test_all_match git checkout -b reset-test update-deep &&
654
- test_all_match git reset --hard update-folder1 &&
655
619
test_all_match git reset base -- \*/a &&
656
- test_all_match git status --porcelain=v2
620
+ test_all_match git status --porcelain=v2 &&
621
+ test_all_match git rev-parse HEAD:folder1/a &&
622
+
623
+ test_all_match git reset base -- folder\* &&
624
+ test_all_match git status --porcelain=v2 &&
625
+ test_all_match git rev-parse HEAD:folder2
657
626
'
658
627
659
628
# NEEDSWORK: although update-index executes without error on files outside
0 commit comments