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

Re: [PATCH] clone: send ref-prefixes when using protocol v2

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 20, 2018, 19:54 UTC
Message-ID
<20180720195401.GA83654@aiede.svl.corp.google.com>
In-Reply-To
<20180720192749.224284-1-bmwill@google.com>
Hi,
Brandon Williams wrote:
Show 7 quoted lines
> Signed-off-by: Brandon Williams <bmwill@google.com>
> ---
> Noticed we miss out on server side filtering of refs when cloning using
> protocol v2, this will enable that.
>
>  builtin/clone.c | 22 +++++++++++++++++-----
>  1 file changed, 17 insertions(+), 5 deletions(-)
Nice!  The implementation looks good.
Can you add a test to ensure this filtering doesn't regress later?
[...]
> +++ b/builtin/clone.c
[...]
Show 14 quoted lines
> @@ -1134,10 +1135,20 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
>  	if (transport->smart_options && !deepen && !filter_options.choice)
>  		transport->smart_options->check_self_contained_and_connected = 1;
>  
> -	refs = transport_get_remote_refs(transport, NULL);
> +
> +	argv_array_push(&ref_prefixes, "HEAD");
> +	refspec_ref_prefixes(&rs, &ref_prefixes);
> +	if (option_branch) {
> +		expand_ref_prefix(&ref_prefixes, option_branch);
> +	}
> +	if (!option_no_tags) {
> +		argv_array_push(&ref_prefixes, "refs/tags/");
> +	}
nit: no need for braces around one-line "if" body

Thanks, Jonathan

Previous: Junio C HamanoNext: Brandon Williams
Message 3 of 4 in “clone: send ref-prefixes when using protocol v2”
  1. clone: send ref-prefixes when using protocol v2Brandon Williams, Jul 20, 2018
  2. Junio C HamanoJul 20, 2018
  3. Jonathan NiederJul 20, 2018
  4. clone: send ref-prefixes when using protocol v2Brandon Williams, Jul 20, 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.