summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2021-11-29 15:52:41 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-11-29 20:51:26 (GMT)
commit20ec2d034cda1afef15a4dcc6e275d7a69413510 (patch)
tree1461ef3b8acc4895f8e31ded1d9674c8fb0a7318 /t
parentc01b1cbd473c05e29fe0c1a31b8f6539e82c4559 (diff)
downloadgit-20ec2d034cda1afef15a4dcc6e275d7a69413510.zip
git-20ec2d034cda1afef15a4dcc6e275d7a69413510.tar.gz
git-20ec2d034cda1afef15a4dcc6e275d7a69413510.tar.bz2
reset: make sparse-aware (except --mixed)
Remove `ensure_full_index` guard on `prime_cache_tree` and update `prime_cache_tree_rec` to correctly reconstruct sparse directory entries in the cache tree. While processing a tree's entries, `prime_cache_tree_rec` must determine whether a directory entry is sparse or not by searching for it in the index (*without* expanding the index). If a matching sparse directory index entry is found, no subtrees are added to the cache tree entry and the entry count is set to 1 (representing the sparse directory itself). Otherwise, the tree is assumed to not be sparse and its subtrees are recursively added to the cache tree. Helped-by: Elijah Newren <newren@gmail.com> Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh15
1 files changed, 13 insertions, 2 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 4125525..871cc3f 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -777,9 +777,9 @@ test_expect_success 'sparse-index is not expanded' '
ensure_not_expanded checkout - &&
ensure_not_expanded switch rename-out-to-out &&
ensure_not_expanded switch - &&
- git -C sparse-index reset --hard &&
+ ensure_not_expanded reset --hard &&
ensure_not_expanded checkout rename-out-to-out -- deep/deeper1 &&
- git -C sparse-index reset --hard &&
+ ensure_not_expanded reset --hard &&
ensure_not_expanded restore -s rename-out-to-out -- deep/deeper1 &&
echo >>sparse-index/README.md &&
@@ -789,6 +789,17 @@ test_expect_success 'sparse-index is not expanded' '
echo >>sparse-index/untracked.txt &&
ensure_not_expanded add . &&
+ for ref in update-deep update-folder1 update-folder2 update-deep
+ do
+ echo >>sparse-index/README.md &&
+ ensure_not_expanded reset --hard $ref || return 1
+ done &&
+
+ ensure_not_expanded reset --hard update-deep &&
+ ensure_not_expanded reset --keep base &&
+ ensure_not_expanded reset --merge update-deep &&
+ ensure_not_expanded reset --hard &&
+
ensure_not_expanded checkout -f update-deep &&
test_config -C sparse-index pull.twohead ort &&
(