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

Re: [PATCH 2/2] {fetch,upload}-pack: support filter in protocol v2

From
BWBrandon Williams <bmwill@google.com>
Date
May 1, 2018, 22:36 UTC
Message-ID
<20180501223619.GA122314@google.com>
In-Reply-To
<0486dfdfe614f908b322552b02ebbb3f1f6cd6fc.1525213052.git.jonathantanmy@google.com>
On 05/01, Jonathan Tan wrote:
Show 18 quoted lines
> The fetch-pack/upload-pack protocol v2 was developed independently of
> the filter parameter (used in partial fetches), thus it did not include
> support for it. Add support for the filter parameter.
> 
> Like in the legacy protocol, the server advertises and supports "filter"
> only if uploadpack.allowfilter is configured.
> 
> Like in the legacy protocol, the client continues with a warning if
> "--filter" is specified, but the server does not advertise it.
> 
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
>  Documentation/technical/protocol-v2.txt |  9 +++
>  fetch-pack.c                            | 23 +++++-
>  t/t5702-protocol-v2.sh                  | 97 +++++++++++++++++++++++++
>  upload-pack.c                           | 12 ++-
>  4 files changed, 135 insertions(+), 6 deletions(-)
> 
Show 10 quoted lines
> @@ -1428,7 +1434,9 @@ int upload_pack_v2(struct repository *r, struct argv_array *keys,
>  int upload_pack_advertise(struct repository *r,
>  			  struct strbuf *value)
>  {
> -	if (value)
> -		strbuf_addstr(value, "shallow");
> +	git_config(upload_pack_config, NULL);
> +	if (value) {
> +		strbuf_addf(value, "%sshallow", allow_filter ? "filter " : "");
> +	}

This is a bit difficult to read and there is no reason why we would need to read the entire upload_pack_config to determine if we need to filter things (we will need to read the config if cmd "fetch" is requested though). Instead it may be better to do the following:

  if (value) {
    strbuf_addstr(value, "shallow");
    if (repo_config_get(r, "uplaodpack.filter"))
      strbuf_addstr(value, " filter");
  }

This way its easier to read and you only are reading the required value from the config.

Show 5 quoted lines
>  	return 1;
>  }
> -- 
> 2.17.0.441.gb46fe60e1d-goog
> 
-- 
Brandon Williams
Previous: Jonathan TanNext: Jonathan Tan
Message 5 of 20 in “Supporting partial clones in protocol v2”
  1. 0/2 Supporting partial clones in protocol v2Jonathan Tan, May 1, 2018
  2. 1/2 upload-pack: fix error message typoJonathan Tan, May 1, 2018
  3. Jonathan TanMay 1, 2018
  4. 2/2 {fetch,upload}-pack: support filter in protocol v2Jonathan Tan, May 1, 2018
  5. Brandon WilliamsMay 1, 2018
  6. 0/3 Supporting partial clones in protocol v2Jonathan Tan, May 2, 2018
  7. 1/3 upload-pack: fix error message typoJonathan Tan, May 2, 2018
  8. Stefan BellerMay 3, 2018
  9. Jonathan TanMay 3, 2018
  10. Junio C HamanoMay 4, 2018
  11. Jonathan TanMay 4, 2018
  12. 2/3 upload-pack: read config when serving protocol v2Jonathan Tan, May 2, 2018
  13. Stefan BellerMay 3, 2018
  14. Jonathan TanMay 3, 2018
  15. 3/3 {fetch,upload}-pack: support filter in protocol v2Jonathan Tan, May 2, 2018
  16. Stefan BellerMay 3, 2018
  17. 0/3 Supporting partial clones in protocol v2Jonathan Tan, May 3, 2018
  18. 1/3 upload-pack: fix error message typoJonathan Tan, May 3, 2018
  19. 2/3 upload-pack: read config when serving protocol v2Jonathan Tan, May 3, 2018
  20. 3/3 {fetch,upload}-pack: support filter in protocol v2Jonathan Tan, May 3, 2018

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.