partial-clone: add a partial-clone test case

In a blobless-cloned repo, `git log --follow -- <path>` (`<path>` have an exact OID rename) shouldn't download blob of the file from where the new file is renamed. Add a test case to verify it. Signed-off-by: Abhradeep Chakraborty <chakrabortyabhradeep79@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Abhradeep Chakraborty committed Mar 16, 2022 at 09:46 UTC ab3892e48f138e9c519383bb9f48fc48f5ebba65
1 file changed +19
t/t0410-partial-clone.sh
+19
@@ -618,6 +618,25 @@ test_expect_success 'do not fetch when checking existence of tree we construct o
618 git -C repo cherry-pick side1
619 '
620
621 +test_expect_success 'exact rename does not need to fetch the blob lazily' '
622 + rm -rf repo partial.git &&
623 + test_create_repo repo &&
624 + content="some dummy content" &&
625 + test_commit -C repo create-a-file file.txt "$content" &&
626 + git -C repo mv file.txt new-file.txt &&
627 + git -C repo commit -m rename-the-file &&
628 + FILE_HASH=$(git -C repo rev-parse HEAD:new-file.txt) &&
629 + test_config -C repo uploadpack.allowfilter 1 &&
630 + test_config -C repo uploadpack.allowanysha1inwant 1 &&
631 +
632 + git clone --filter=blob:none --bare "file://$(pwd)/repo" partial.git &&
633 + git -C partial.git rev-list --objects --missing=print HEAD >out &&
634 + grep "[?]$FILE_HASH" out &&
635 + git -C partial.git log --follow -- new-file.txt &&
636 + git -C partial.git rev-list --objects --missing=print HEAD >out &&
637 + grep "[?]$FILE_HASH" out
638 +'
639 +
640 test_expect_success 'lazy-fetch when accessing object not in the_repository' '
641 rm -rf full partial.git &&
642 test_create_repo full &&