Skip to content

Commit ab3892e

Browse files
Abhra303gitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b896f72 commit ab3892e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

t/t0410-partial-clone.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,25 @@ test_expect_success 'do not fetch when checking existence of tree we construct o
618618
git -C repo cherry-pick side1
619619
'
620620

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+
621640
test_expect_success 'lazy-fetch when accessing object not in the_repository' '
622641
rm -rf full partial.git &&
623642
test_create_repo full &&

0 commit comments

Comments
 (0)