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:
authorDerrick Stolee <derrickstolee@github.com>2022-05-23 16:48:38 +0300
committerJunio C Hamano <gitster@pobox.com>2022-05-23 21:08:20 +0300
commit8846847a142d720f63b5cbf9f0481c7694445ace (patch)
treeb05cea75a1d346f2bcee6054e49481e4978947a0 /t/t1092-sparse-checkout-compatibility.sh
parentbaa73e2b75645a088268266a408f502457663876 (diff)
t1092: stress test 'git sparse-checkout set'
The 'sparse-index contents' test checks that the sparse index has the correct set of sparse directories in the index after modifying the cone mode patterns using 'git sparse-checkout set'. Add to the coverage here by adding more complicated scenarios that were not previously tested. In order to check paths that do not exist at HEAD, we need to modify the test_sparse_checkout_set helper slightly: 1. Add the --skip-checks argument to the 'set' command to avoid failures when passing paths that do not exist at HEAD. 2. When looking for the non-existence of sparse directories for the paths in $CONE_DIRS, allow the rev-list command to fail because the path does not exist at HEAD. This allows us to add some interesting test cases. Helped-by: Victoria Dye <vdye@github.com> Signed-off-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.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 9355e75a5d..a8f3ce8aa2 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -212,7 +212,7 @@ test_sparse_unstaged () {
test_sparse_checkout_set () {
CONE_DIRS=$1 &&
SPARSE_DIRS=$2 &&
- git -C sparse-index sparse-checkout set $CONE_DIRS &&
+ git -C sparse-index sparse-checkout set --skip-checks $CONE_DIRS &&
git -C sparse-index ls-files --sparse --stage >cache &&
# Check that the directories outside of the sparse-checkout cone
@@ -228,7 +228,9 @@ test_sparse_checkout_set () {
# are not sparse directory entries.
for dir in $CONE_DIRS
do
- TREE=$(git -C sparse-index rev-parse HEAD:$dir) &&
+ # Allow TREE to not exist because
+ # $dir does not exist at HEAD.
+ TREE=$(git -C sparse-index rev-parse HEAD:$dir) ||
! grep "040000 $TREE 0 $dir/" cache \
|| return 1
done
@@ -253,6 +255,19 @@ test_expect_success 'sparse-index contents' '
"deep/deeper2 folder1 folder2 x" \
"before deep/deeper1" &&
+ # Replace deep/deeper2 with deep/deeper1
+ # Replace folder1 with folder1/0/0
+ # Replace folder2 with non-existent folder2/2/3
+ # Add non-existent "bogus"
+ test_sparse_checkout_set \
+ "bogus deep/deeper1 folder1/0/0 folder2/2/3 x" \
+ "before deep/deeper2 folder2/0" &&
+
+ # Drop down to only files at root
+ test_sparse_checkout_set \
+ "" \
+ "before deep folder1 folder2 x" &&
+
# Disabling the sparse-index replaces tree entries with full ones
git -C sparse-index sparse-checkout init --no-sparse-index &&
test_sparse_match git ls-files --stage --sparse