Skip to content

Commit 88ab367

Browse files
committed
t1092: test ignored files outside of cone
When a sparse directory leaves the sparse-checkout definition, we leave the ignored files in place. This then requires commands like 'git status' to expand a sparse index to find contained '.gitignore' files within the sparse directory. This test is marked as an expected failure, and the failures happen within the ensure_not_expanded lines. Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
1 parent 1c47a8f commit 88ab367

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ test_expect_success 'setup' '
4242
cp -r deep/deeper1/0 folder2 &&
4343
echo >>folder1/0/0/0 &&
4444
echo >>folder2/0/1 &&
45+
46+
cat >.gitignore <<-\EOF &&
47+
obj/
48+
*.o
49+
EOF
50+
4551
git add . &&
4652
git commit -m "initial commit" &&
4753
git checkout -b base &&
@@ -62,6 +68,7 @@ test_expect_success 'setup' '
6268
EOF
6369
cp folder1/larger-content folder2/ &&
6470
cp folder1/larger-content deep/deeper1/ &&
71+
6572
git add . &&
6673
git commit -m "add interesting rename content" &&
6774
@@ -587,6 +594,44 @@ test_expect_success 'sparse-index is not expanded' '
587594
ensure_not_expanded add .
588595
'
589596

597+
test_expect_failure 'sparse-index is not expanded (with ignored files outside cone)' '
598+
init_repos &&
599+
600+
write_script adjust_repo <<-\EOF &&
601+
mkdir folder1 obj folder1/obj &&
602+
echo ignored >folder1/obj/a &&
603+
echo ignored >obj/a &&c
604+
echo ignored >folder1/file.o &&
605+
echo ignored >folder1.o
606+
EOF
607+
608+
run_on_all ../adjust_repo &&
609+
610+
ensure_not_expanded status &&
611+
ensure_not_expanded commit --allow-empty -m empty &&
612+
echo >>sparse-index/a &&
613+
ensure_not_expanded commit -a -m a &&
614+
echo >>sparse-index/a &&
615+
ensure_not_expanded commit --include a -m a &&
616+
echo >>sparse-index/deep/deeper1/a &&
617+
ensure_not_expanded commit --include deep/deeper1/a -m deeper &&
618+
ensure_not_expanded checkout rename-out-to-out &&
619+
ensure_not_expanded checkout - &&
620+
ensure_not_expanded switch rename-out-to-out &&
621+
ensure_not_expanded switch - &&
622+
git -C sparse-index reset --hard &&
623+
ensure_not_expanded checkout rename-out-to-out -- deep/deeper1 &&
624+
git -C sparse-index reset --hard &&
625+
ensure_not_expanded restore -s rename-out-to-out -- deep/deeper1 &&
626+
627+
echo >>sparse-index/README.md &&
628+
ensure_not_expanded add -A &&
629+
echo >>sparse-index/extra.txt &&
630+
ensure_not_expanded add extra.txt &&
631+
echo >>sparse-index/untracked.txt &&
632+
ensure_not_expanded add .
633+
'
634+
590635
test_expect_success 'reset mixed and checkout orphan' '
591636
init_repos &&
592637

0 commit comments

Comments
 (0)