Subject: Re: [PATCH v2] partial-clone: add a partial-clone test case

From: Derrick Stolee <[email-masked]>
Date: Mon, 21 Mar 2022 11:26:14 -0400

On 3/16/2022 5:46 AM, Abhradeep Chakraborty via GitGitGadget wrote:
> From: Abhradeep Chakraborty <[email-masked]>
> 
> 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-masked]>
> ---
>     partial-clone: add a partial-clone test case
>     
>     changes since v1:
>     
>      1. remove the event track method to detect the downloading as it is not
>         future proof ( and buggy).
>      2. Instead see if the file is missing initially and after running the
>         git log --follow ... command.

> +test_expect_success 'exact rename does not need to fetch the blob lazily' '
> +	rm -rf repo partial.git &&
> +	test_create_repo repo &&
> +	content="some dummy content" &&
> +	test_commit -C repo create-a-file file.txt "$content" &&
> +	git -C repo mv file.txt new-file.txt &&
> +	git -C repo commit -m rename-the-file &&
> +	FILE_HASH=$(git -C repo rev-parse HEAD:new-file.txt) &&
> +	test_config -C repo uploadpack.allowfilter 1 &&
> +	test_config -C repo uploadpack.allowanysha1inwant 1 &&
> +
> +	git clone --filter=blob:none --bare "file://$(pwd)/repo" partial.git &&
> +	git -C partial.git rev-list --objects --missing=print HEAD >out &&
> +	grep "[?]$FILE_HASH" out &&
> +	git -C partial.git log --follow -- new-file.txt &&
> +	git -C partial.git rev-list --objects --missing=print HEAD >out &&
> +	grep "[?]$FILE_HASH" out
> +'
> +

Thanks for taking the feedback and turning it into a good test!

I'm adding it as a TODO to go fix the buggy helper as discussed.

Thanks,
-Stolee