diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-05-21 01:26:58 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-05-21 01:26:58 +0300 |
commit | acdeb10f91da939135fbacb847792ae237450d7d (patch) | |
tree | 1989381cb6b65293630bd86533abde899ab52130 /t | |
parent | 5a9253cd45494b7b8aed8166529c5c451086f451 (diff) | |
parent | 124b05b23005437fa5fb91863bde2a8f5840e164 (diff) |
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')
-rwxr-xr-x | t/t1092-sparse-checkout-compatibility.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index 19221c1422..6f778cf28c 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 && |