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

Re: [PATCH 07/10] receive-pack: request for packv4 if it's the preferred version

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 17, 2013, 17:26 UTC
Message-ID
<xmqqzjq724hu.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1380162409-18224-8-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 20 quoted lines
> This is the only plumbing command that is controlled by
> core.preferredPackVersion so far.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Documentation/technical/protocol-capabilities.txt | 4 ++++
>  builtin/receive-pack.c                            | 3 ++-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/technical/protocol-capabilities.txt b/Documentation/technical/protocol-capabilities.txt
> index be09792..32153cd 100644
> --- a/Documentation/technical/protocol-capabilities.txt
> +++ b/Documentation/technical/protocol-capabilities.txt
> @@ -226,4 +226,8 @@ this capability, the server may send a pack version 4. The server can
>  choose to send pack version 2 even if the client accepts this
>  capability.
>  
> +The receive-pack server advertises this capability if it wants to
> +receive the pack in format version 4 and the client should send in
> +this format.

Technically, "if it can and if it wants to receive" is more correct, as a v4 capable receiving end can choose to pretend it does not understand v4 by not sending this capability. Also a v4 incapable receiver would not advertise it even if it _wants_ to receive. So in practice, we see this header only from a receiver that wants to receive v4, which makes the above statement accurate in a twisted way.

There needs a bit more explanation on the "should" part, especially because this is very unusual and unlike all the other capabilities, which are offered as more freedom of choices without preference on the advertising side. Rationale (i.e. reduce load on the receiving end) and ramifications of non-compliance (e.g. the receiver may choose to fail the push when its load is too high) are good things to guide third-party implementors to do the right thing.

Show 18 quoted lines
>  This capability does not include multi-base tree support.
> diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
> index e3eb5fc..288b0bc 100644
> --- a/builtin/receive-pack.c
> +++ b/builtin/receive-pack.c
> @@ -130,10 +130,11 @@ static void show_ref(const char *path, const unsigned char *sha1)
>  	if (sent_capabilities)
>  		packet_write(1, "%s %s\n", sha1_to_hex(sha1), path);
>  	else
> -		packet_write(1, "%s %s%c%s%s agent=%s\n",
> +		packet_write(1, "%s %s%c%s%s%s agent=%s\n",
>  			     sha1_to_hex(sha1), path, 0,
>  			     " report-status delete-refs side-band-64k quiet",
>  			     prefer_ofs_delta ? " ofs-delta" : "",
> +			     core_default_pack_version == 4 ? " packv4" : "",
>  			     git_user_agent_sanitized());
>  	sent_capabilities = 1;
>  }
Previous: Nguyễn Thái Ngọc DuyNext: Nguyễn Thái Ngọc Duy
Message 9 of 20 in “pack v4 UI support”
  1. 00/10 pack v4 UI supportNguyễn Thái Ngọc Duy, Sep 26, 2013
  2. 01/10 test-dump: new test program to examine binary dataNguyễn Thái Ngọc Duy, Sep 26, 2013
  3. 02/10 config: add core.preferredPackVersionNguyễn Thái Ngọc Duy, Sep 26, 2013
  4. 03/10 upload-pack: new capability to send pack v4Nguyễn Thái Ngọc Duy, Sep 26, 2013
  5. 04/10 fetch: new option to set preferred pack version for transferNguyễn Thái Ngọc Duy, Sep 26, 2013
  6. 05/10 clone: new option to set preferred pack version for transferNguyễn Thái Ngọc Duy, Sep 26, 2013
  7. 06/10 fetch: pack v4 support on smart httpNguyễn Thái Ngọc Duy, Sep 26, 2013
  8. 07/10 receive-pack: request for packv4 if it's the preferred versionNguyễn Thái Ngọc Duy, Sep 26, 2013
  9. Junio C HamanoOct 17, 2013
  10. 08/10 send-pack: support pack v4Nguyễn Thái Ngọc Duy, Sep 26, 2013
  11. 09/10 repack: add --pack-version and fall back to core.preferredPackVersionNguyễn Thái Ngọc Duy, Sep 26, 2013
  12. repack: Add --version parameterStefan Beller, Sep 26, 2013
  13. Felipe ContrerasSep 26, 2013
  14. Stefan BellerSep 28, 2013
  15. Duy NguyenSep 26, 2013
  16. Stefan BellerSep 28, 2013
  17. 10/10 count-objects: report pack v4 usageNguyễn Thái Ngọc Duy, Sep 26, 2013
  18. Nicolas PitreSep 26, 2013
  19. Duy NguyenSep 26, 2013
  20. Nicolas PitreSep 27, 2013

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.