301
test_all_match git checkout -
302
'
303
304
-# NEEDSWORK: This documents current behavior, but is not a desirable
305
-# behavior (untracked files are handled differently than tracked).
304
test_expect_success 'add outside sparse cone' '
305
init_repos &&
306
310
test_sparse_match test_must_fail git add folder1/a &&
311
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
312
test_sparse_unstaged folder1/a &&
315
- test_sparse_match git add folder1/newfile
313
+ test_sparse_match test_must_fail git add folder1/newfile &&
314
+ grep "Disable or modify the sparsity rules" sparse-checkout-err &&
315
+ test_sparse_unstaged folder1/newfile
316
'
317
318
test_expect_success 'commit including unstaged changes' '
343
test_all_match git status --porcelain=v2
344
'
345
346
-test_expect_success 'status/add: outside sparse cone' '
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' '
351
init_repos &&
352
353
# folder1 is at HEAD, but outside the sparse cone
372
test_sparse_match test_must_fail git add --refresh folder1/a &&
373
grep "Disable or modify the sparsity rules" sparse-checkout-err &&
374
test_sparse_unstaged folder1/a &&
375
+ test_sparse_match test_must_fail git add folder1/new &&
376
+ grep "Disable or modify the sparsity rules" sparse-checkout-err &&
377
+ test_sparse_unstaged folder1/new &&
378
372
- # NEEDSWORK: Adding a newly-tracked file outside the cone succeeds
373
- test_sparse_match git add folder1/new &&
374
-
379
+ # NEEDSWORK: behavior begins to deviate here.
380
test_all_match git add . &&
381
test_all_match git status --porcelain=v2 &&
382
test_all_match git commit -m folder1/new &&
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.
530
-test_expect_success 'merge with conflict outside cone' '
535
+test_expect_failure 'merge with conflict outside cone' '
536
init_repos &&
537
538
test_all_match git checkout -b merge-tip merge-left &&
546
test_all_match git status --porcelain=v2 &&
547
548
# 2. Add the file with conflict markers
549
+ # NEEDSWORK: Even though the merge conflict removed the
550
+ # SKIP_WORKTREE bit from the index entry for folder1/a, we should
551
+ # warn that this is a problematic add.
552
test_all_match git add folder1/a &&
553
test_all_match git status --porcelain=v2 &&
554
555
# 3. Rename the file to another sparse filename and
556
# accept conflict markers as resolved content.
557
run_on_all mv folder2/a folder2/z &&
558
+ # NEEDSWORK: This mode now fails, because folder2/z is
559
+ # outside of the sparse-checkout cone and does not match an
560
+ # existing index entry with the SKIP_WORKTREE bit cleared.
561
test_all_match git add folder2 &&
562
test_all_match git status --porcelain=v2 &&
563
566
test_all_match git rev-parse HEAD^{tree}
567
'
568
558
-test_expect_success 'cherry-pick/rebase with conflict outside cone' '
569
+test_expect_failure 'cherry-pick/rebase with conflict outside cone' '
570
init_repos &&
571
572
for OPERATION in cherry-pick rebase
583
test_all_match git status --porcelain=v2 &&
584
585
# 2. Add the file with conflict markers
586
+ # NEEDSWORK: Even though the merge conflict removed the
587
+ # SKIP_WORKTREE bit from the index entry for folder1/a, we should
588
+ # warn that this is a problematic add.
589
test_all_match git add folder1/a &&
590
test_all_match git status --porcelain=v2 &&
591
592
# 3. Rename the file to another sparse filename and
593
# accept conflict markers as resolved content.
594
+ # NEEDSWORK: This mode now fails, because folder2/z is
595
+ # outside of the sparse-checkout cone and does not match an
596
+ # existing index entry with the SKIP_WORKTREE bit cleared.
597
run_on_all mv folder2/a folder2/z &&
598
test_all_match git add folder2 &&
599
test_all_match git status --porcelain=v2 &&
671
test_expect_success 'submodule handling' '
672
init_repos &&
673
674
+ test_sparse_match git sparse-checkout add modules &&
675
test_all_match mkdir modules &&
676
test_all_match touch modules/a &&
677
test_all_match git add modules &&
681
test_all_match git commit -m "add submodule" &&
682
683
# having a submodule prevents "modules" from collapse
684
+ test_sparse_match git sparse-checkout set deep/deeper1 &&
685
test-tool -C sparse-index read-cache --table >cache &&
686
grep "100644 blob .* modules/a" cache &&
687
grep "160000 commit $(git -C initial-repo rev-parse HEAD) modules/sub" cache