343
test_all_match git status --porcelain=v2
344
'
345
346
-# NEEDSWORK: Now that 'git add folder1/new' fails, the changes being
347
-# attempted here fail for the sparse-checkout and sparse-index repos.
348
-# We must enable a way for adding files outside the sparse-checkout
349
-# done, even if it is by an optional flag.
350
-test_expect_failure 'status/add: outside sparse cone' '
346
+test_expect_success 'status/add: outside sparse cone' '
347
init_repos &&
348
349
# folder1 is at HEAD, but outside the sparse cone
371
test_sparse_match test_must_fail git add folder1/new &&
372
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
373
test_sparse_unstaged folder1/new &&
374
+ test_sparse_match git add --sparse folder1/a &&
375
+ test_sparse_match git add --sparse folder1/new &&
376
379
- # NEEDSWORK: behavior begins to deviate here.
380
- test_all_match git add . &&
377
+ test_all_match git add --sparse . &&
378
test_all_match git status --porcelain=v2 &&
379
test_all_match git commit -m folder1/new &&
380
test_all_match git rev-parse HEAD^{tree} &&
381
382
run_on_all ../edit-contents folder1/newer &&
386
- test_all_match git add folder1/ &&
383
+ test_all_match git add --sparse folder1/ &&
384
test_all_match git status --porcelain=v2 &&
385
test_all_match git commit -m folder1/newer &&
386
test_all_match git rev-parse HEAD^{tree}
524
done
525
'
526
530
-# NEEDSWORK: This test is documenting current behavior, but that
531
-# behavior can be confusing to users so there is desire to change it.
532
-# Right now, users might be using this flow to work through conflicts,
533
-# so any solution should present advice to users who try this sequence
534
-# of commands to follow whatever new method we create.
535
-test_expect_failure 'merge with conflict outside cone' '
527
+test_expect_success 'merge with conflict outside cone' '
528
init_repos &&
529
530
test_all_match git checkout -b merge-tip merge-left &&
541
test_sparse_match test_must_fail git add folder1/a &&
542
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
543
test_sparse_unstaged folder1/a &&
544
+ test_all_match git add --sparse folder1/a &&
545
test_all_match git status --porcelain=v2 &&
546
547
# 3. Rename the file to another sparse filename and
548
# accept conflict markers as resolved content.
549
run_on_all mv folder2/a folder2/z &&
557
- # NEEDSWORK: This mode now fails, because folder2/z is
558
- # outside of the sparse-checkout cone and does not match an
559
- # existing index entry with the SKIP_WORKTREE bit cleared.
550
test_sparse_match test_must_fail git add folder2 &&
551
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
552
test_sparse_unstaged folder2/z &&
553
+ test_all_match git add --sparse folder2 &&
554
test_all_match git status --porcelain=v2 &&
555
556
test_all_match git merge --continue &&
558
test_all_match git rev-parse HEAD^{tree}
559
'
560
570
-test_expect_failure 'cherry-pick/rebase with conflict outside cone' '
561
+test_expect_success 'cherry-pick/rebase with conflict outside cone' '
562
init_repos &&
563
564
for OPERATION in cherry-pick rebase
581
test_sparse_match test_must_fail git add folder1/a &&
582
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
583
test_sparse_unstaged folder1/a &&
584
+ test_all_match git add --sparse folder1/a &&
585
test_all_match git status --porcelain=v2 &&
586
587
# 3. Rename the file to another sparse filename and
593
test_sparse_match test_must_fail git add folder2 &&
594
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
595
test_sparse_unstaged folder2/z &&
596
+ test_all_match git add --sparse folder2 &&
597
test_all_match git status --porcelain=v2 &&
598
599
test_all_match git $OPERATION --continue &&