summaryrefslogtreecommitdiff
path: root/t/t0410-partial-clone.sh
diff options
context:
space:
mode:
authorLibravatar Jonathan Tan <jonathantanmy@google.com>2021-06-17 10:13:26 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-06-28 09:58:01 -0700
commitef830cc4341260ef45ffe6c7164e23505d45a5a2 (patch)
tree00c3bb9dcaadf183c1b11929a0f5ed9286973ffe /t/t0410-partial-clone.sh
parentrun-command: refactor subprocess env preparation (diff)
downloadtgif-ef830cc4341260ef45ffe6c7164e23505d45a5a2.tar.xz
promisor-remote: teach lazy-fetch in any repo
This is one step towards supporting partial clone submodules. Even after this patch, we will still lack partial clone submodules support, primarily because a lot of Git code that accesses submodule objects does so by adding their object stores as alternates, meaning that any lazy fetches that would occur in the submodule would be done based on the config of the superproject, not of the submodule. This also prevents testing of the functionality in this patch by user-facing commands. So for now, test this mechanism using a test helper. Besides that, there is some code that uses the wrapper functions like has_promisor_remote(). Those will need to be checked to see if they could support the non-wrapper functions instead (and thus support any repository, not just the_repository). Signed-off-by: Jonathan Tan <jonathantanmy@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0410-partial-clone.sh')
-rwxr-xr-xt/t0410-partial-clone.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/t/t0410-partial-clone.sh b/t/t0410-partial-clone.sh
index 584a039b85..a211a66c67 100755
--- a/t/t0410-partial-clone.sh
+++ b/t/t0410-partial-clone.sh
@@ -604,6 +604,29 @@ test_expect_success 'do not fetch when checking existence of tree we construct o
git -C repo cherry-pick side1
'
+test_expect_success 'lazy-fetch when accessing object not in the_repository' '
+ rm -rf full partial.git &&
+ test_create_repo full &&
+ test_commit -C full create-a-file file.txt &&
+
+ test_config -C full uploadpack.allowfilter 1 &&
+ test_config -C full uploadpack.allowanysha1inwant 1 &&
+ git clone --filter=blob:none --bare "file://$(pwd)/full" partial.git &&
+ FILE_HASH=$(git -C full rev-parse HEAD:file.txt) &&
+
+ # Sanity check that the file is missing
+ git -C partial.git rev-list --objects --missing=print HEAD >out &&
+ grep "[?]$FILE_HASH" out &&
+
+ git -C full cat-file -s "$FILE_HASH" >expect &&
+ test-tool partial-clone object-info partial.git "$FILE_HASH" >actual &&
+ test_cmp expect actual &&
+
+ # Sanity check that the file is now present
+ git -C partial.git rev-list --objects --missing=print HEAD >out &&
+ ! grep "[?]$FILE_HASH" out
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd