Skip to content

Commit 1143cc0

Browse files
ffyuandagitster
authored andcommitted
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 <[email protected]> Signed-off-by: Shaoxuan Yuan <[email protected]> Acked-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 367844e commit 1143cc0

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,4 +1828,29 @@ test_expect_success 'checkout behaves oddly with df-conflict-2' '
18281828
test_cmp full-checkout-err sparse-index-err
18291829
'
18301830

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+
18311856
test_done

0 commit comments

Comments
 (0)