Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShaoxuan Yuan <shaoxuan.yuan02@gmail.com>2022-06-30 05:37:31 +0300
committerJunio C Hamano <gitster@pobox.com>2022-07-02 00:50:15 +0300
commit1143cc01b722225b041eb5db0bd733bdb4549949 (patch)
treec3b13f32a5136fa3ebd14bbd6c502b4f2a13c59c /t/t1092-sparse-checkout-compatibility.sh
parent367844e5b747883f4456fd17201da6e6f5320f4a (diff)
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>
Diffstat (limited to 't/t1092-sparse-checkout-compatibility.sh')
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index f9f8c988bb..5eef799e25 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -1828,4 +1828,29 @@ test_expect_success 'checkout behaves oddly with df-conflict-2' '
test_cmp full-checkout-err sparse-index-err
'
+test_expect_failure 'mv directory from out-of-cone to in-cone' '
+ init_repos &&
+
+ # <source> as a sparse directory (or SKIP_WORKTREE_DIR without enabling
+ # sparse index).
+ test_all_match git mv --sparse folder1 deep &&
+ test_all_match git status --porcelain=v2 &&
+ test_sparse_match git ls-files -t &&
+ git -C sparse-checkout ls-files -t >actual &&
+ grep -e "H deep/folder1/0/0/0" actual &&
+ grep -e "H deep/folder1/0/1" actual &&
+ grep -e "H deep/folder1/a" actual &&
+
+ test_all_match git reset --hard &&
+
+ # <source> as a directory deeper than sparse index boundary (where
+ # sparse index will expand).
+ test_sparse_match git mv --sparse folder1/0 deep &&
+ test_sparse_match git status --porcelain=v2 &&
+ test_sparse_match git ls-files -t &&
+ git -C sparse-checkout ls-files -t >actual &&
+ grep -e "H deep/0/0/0" actual &&
+ grep -e "H deep/0/1" actual
+'
+
test_done