t1092: mv directory from out-of-cone to in-cone
Add test for "mv: add check_dir_in_index() and solve general dir check issue" in this series. This change tests the following: 1. mv <source> as a directory on the sparse index boundary (where it would be a sparse directory in a sparse index). 2. mv <source> as a directory which is deeper than the boundary (so the sparse index would expand in the cache_name_pos() method). These tests can be written now for correctness, but later the first case can be updated to use the 'ensure_not_expanded' helper in t1092. Suggested-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Shaoxuan Yuan <shaoxuan.yuan02@gmail.com> Acked-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Shaoxuan Yuan committed
Jun 30, 2022 at 10:37 UTC
1143cc01b722225b041eb5db0bd733bdb4549949
1 file changed
+25
t/t1092-sparse-checkout-compatibility.sh
+25
@@ -1828,4 +1828,29 @@ test_expect_success 'checkout behaves oddly with df-conflict-2' '
1828
test_cmp full-checkout-err sparse-index-err
1829
'
1830
1831
+test_expect_failure 'mv directory from out-of-cone to in-cone' '
1832
+ init_repos &&
1833
+
1834
+ # <source> as a sparse directory (or SKIP_WORKTREE_DIR without enabling
1835
+ # sparse index).
1836
+ test_all_match git mv --sparse folder1 deep &&
1837
+ test_all_match git status --porcelain=v2 &&
1838
+ test_sparse_match git ls-files -t &&
1839
+ git -C sparse-checkout ls-files -t >actual &&
1840
+ grep -e "H deep/folder1/0/0/0" actual &&
1841
+ grep -e "H deep/folder1/0/1" actual &&
1842
+ grep -e "H deep/folder1/a" actual &&
1843
+
1844
+ test_all_match git reset --hard &&
1845
+
1846
+ # <source> as a directory deeper than sparse index boundary (where
1847
+ # sparse index will expand).
1848
+ test_sparse_match git mv --sparse folder1/0 deep &&
1849
+ test_sparse_match git status --porcelain=v2 &&
1850
+ test_sparse_match git ls-files -t &&
1851
+ git -C sparse-checkout ls-files -t >actual &&
1852
+ grep -e "H deep/0/0/0" actual &&
1853
+ grep -e "H deep/0/1" actual
1854
+'
1855
+
1856
test_done