summaryrefslogtreecommitdiff
path: root/t/t1092-sparse-checkout-compatibility.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-05-20 22:26:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-05-20 22:26:58 (GMT)
commitacdeb10f91da939135fbacb847792ae237450d7d (patch)
tree1989381cb6b65293630bd86533abde899ab52130 /t/t1092-sparse-checkout-compatibility.sh
parent5a9253cd45494b7b8aed8166529c5c451086f451 (diff)
parent124b05b23005437fa5fb91863bde2a8f5840e164 (diff)
downloadgit-acdeb10f91da939135fbacb847792ae237450d7d.zip
git-acdeb10f91da939135fbacb847792ae237450d7d.tar.gz
git-acdeb10f91da939135fbacb847792ae237450d7d.tar.bz2
Merge branch 'ds/sparse-colon-path'
"git show :<path>" learned to work better with the sparse-index feature. * ds/sparse-colon-path: rev-parse: integrate with sparse index object-name: diagnose trees in index properly object-name: reject trees found in the index show: integrate with the sparse index t1092: add compatibility tests for 'git show'
Diffstat (limited to 't/t1092-sparse-checkout-compatibility.sh')
-rwxr-xr-xt/t1092-sparse-checkout-compatibility.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
index 19221c1..6f778cf 100755
--- a/t/t1092-sparse-checkout-compatibility.sh
+++ b/t/t1092-sparse-checkout-compatibility.sh
@@ -1200,6 +1200,33 @@ test_expect_success 'clean' '
test_sparse_match test_path_is_dir folder1
'
+for builtin in show rev-parse
+do
+ test_expect_success "$builtin (cached blobs/trees)" "
+ init_repos &&
+
+ test_all_match git $builtin :a &&
+ test_all_match git $builtin :deep/a &&
+ test_sparse_match git $builtin :folder1/a &&
+
+ # The error message differs depending on whether
+ # the directory exists in the worktree.
+ test_all_match test_must_fail git $builtin :deep/ &&
+ test_must_fail git -C full-checkout $builtin :folder1/ &&
+ test_sparse_match test_must_fail git $builtin :folder1/ &&
+
+ # Change the sparse cone for an extra case:
+ run_on_sparse git sparse-checkout set deep/deeper1 &&
+
+ # deep/deeper2 is a sparse directory in the sparse index.
+ test_sparse_match test_must_fail git $builtin :deep/deeper2/ &&
+
+ # deep/deeper2/deepest is not in the sparse index, but
+ # will trigger an index expansion.
+ test_sparse_match test_must_fail git $builtin :deep/deeper2/deepest/
+ "
+done
+
test_expect_success 'submodule handling' '
init_repos &&
@@ -1448,6 +1475,15 @@ test_expect_success 'sparse index is not expanded: diff' '
ensure_not_expanded diff --cached
'
+test_expect_success 'sparse index is not expanded: show and rev-parse' '
+ init_repos &&
+
+ ensure_not_expanded show :a &&
+ ensure_not_expanded show :deep/a &&
+ ensure_not_expanded rev-parse :a &&
+ ensure_not_expanded rev-parse :deep/a
+'
+
test_expect_success 'sparse index is not expanded: update-index' '
init_repos &&