git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] fetch-pack: in partial clone, pass --promisor

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 20, 2020, 20:11 UTC
Message-ID
<xmqqimddaxhz.fsf@gitster.c.googlers.com>
In-Reply-To
<20200820175116.3889786-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 6 quoted lines
> When fetching a pack from a promisor remote, the corresponding .promisor
> file needs to be created. "fetch-pack" originally did this by passing
> "--promisor" to "index-pack", but in 5374a290aa ("fetch-pack: write
> fetched refs to .promisor", 2019-10-16), "fetch-pack" was taught to do
> this itself instead, because it needed to store ref information in the
> .promisor file.
So is this patch a fix for a regression in v2.25?
Show 6 quoted lines
> This causes a problem ...
> ...
> An alternative is to instead move object checking to "fetch-pack", and
> let "index-pack" only index the files. However, since "index-pack" has
> to inflate objects in order to index them, it seems reasonable to also
> let it check the objects (which also require inflated files).

I can see why it might feel attractive to draw the line to divide the labor between the two that way, but I 100% agree with your reasoning---index-pack needs to inspect the objects in order for it to be able to index, and in order for us to be able to trust the resulting index, it should be validating the objects it identified while it was indexing the pack stream.

Show 40 quoted lines
> +
> +		if (args->from_promisor)
> +			/*
> +			 * write_promisor_file() may be called afterwards but
> +			 * we still need index-pack to know that this is a
> +			 * promisor pack. For example, if transfer.fsckobjects
> +			 * is true, index-pack needs to know that .gitmodules
> +			 * is a promisor object (so that it won't complain if
> +			 * it is missing).
> +			 */
>  			strvec_push(&cmd.args, "--promisor");
>  	}
>  	else {
> diff --git a/t/t5616-partial-clone.sh b/t/t5616-partial-clone.sh
> index 8827c2ed18..5a01466db4 100755
> --- a/t/t5616-partial-clone.sh
> +++ b/t/t5616-partial-clone.sh
> @@ -163,6 +163,22 @@ test_expect_success 'manual prefetch of missing objects' '
>  	test_line_count = 0 observed.oids
>  '
>  
> +test_expect_success 'partial clone with transfer.fsckobjects=1 works with submodules' '
> +	test_create_repo submodule &&
> +	test_commit -C submodule mycommit &&
> +
> +	test_create_repo src_with_sub &&
> +	test_config -C src_with_sub uploadpack.allowfilter 1 &&
> +	test_config -C src_with_sub uploadpack.allowanysha1inwant 1 &&
> +
> +	git -C src_with_sub submodule add "file://$(pwd)/submodule" mysub &&
> +	git -C src_with_sub commit -m "commit with submodule" &&
> +
> +	git -c transfer.fsckobjects=1 \
> +		clone --filter="blob:none" "file://$(pwd)/src_with_sub" dst &&
> +	test_when_finished rm -rf dst
> +'
> +
>  test_expect_success 'partial clone with transfer.fsckobjects=1 uses index-pack --fsck-objects' '
>  	git init src &&
>  	test_commit -C src x &&
Previous: Jonathan TanNext: Jonathan Tan
Message 2 of 4 in “fetch-pack: in partial clone, pass --promisor”
  1. fetch-pack: in partial clone, pass --promisorJonathan Tan, Aug 20, 2020
  2. Junio C HamanoAug 20, 2020
  3. Jonathan TanAug 21, 2020
  4. Junio C HamanoAug 21, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.