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

[PATCH v2 0/2] Server options when cloning

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Apr 9, 2019, 20:31 UTC
Message-ID
<cover.1554841624.git.jonathantanmy@google.com>
In-Reply-To
<20190405204413.93900-1-jonathantanmy@google.com>

I created v2 by rewriting jt/clone-server-option, so you'll see some Reviewed-by lines and Signed-off-by lines with another name than mine.

Changes from v1:
 - Broke long line. (DUP->NODUP was already done by Junio in
   jt/clone-server-option, so you don't see it in the range-diff below.)
 - Warn if server-option is specified but not sent to the server (in
   fetch and clone).
 - Document that server's handling of server-option is server-specific.

These patches are on maint, matching jt/clone-server-option, but should apply cleanly on master too.

Jonathan Tan (2):
  transport: warn if server options are unsupported
  clone: send server options when using protocol v2
 Documentation/fetch-options.txt |  3 ++-
 Documentation/git-clone.txt     |  8 +++++++
 builtin/clone.c                 |  6 ++++++
 t/t5702-protocol-v2.sh          | 38 +++++++++++++++++++++++++++++++++
 transport.c                     |  8 +++++++
 5 files changed, 62 insertions(+), 1 deletion(-)
Range-diff against v1:
-:  ---------- > 1:  af3cc05324 transport: warn if server options are unsupported
1:  90ce94e039 ! 2:  142c25abd2 clone: send server options when using protocol v2
    @@ -11,10 +11,27 @@
         has "-o" for another parameter, teach "clone" only to receive
         "--server-option".
     
    +    Explain in the documentation, both for clone and for fetch, that server
    +    handling of server options are server-specific.
    +
         Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
         Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
         Signed-off-by: Junio C Hamano <gitster@pobox.com>
     
    + diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
    + --- a/Documentation/fetch-options.txt
    + +++ b/Documentation/fetch-options.txt
    +@@
    + --server-option=<option>::
    + 	Transmit the given string to the server when communicating using
    + 	protocol version 2.  The given string must not contain a NUL or LF
    +-	character.
    ++	character.  The server's handling of server options, including
    ++	unknown ones, is server-specific.
    + 	When multiple `--server-option=<option>` are given, they are all
    + 	sent to the other side in the order listed on the command line.
    + 
    +
      diff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt
      --- a/Documentation/git-clone.txt
      +++ b/Documentation/git-clone.txt
    @@ -25,7 +42,8 @@
     +--server-option=<option>::
     +	Transmit the given string to the server when communicating using
     +	protocol version 2.  The given string must not contain a NUL or LF
    -+	character.
    ++	character.  The server's handling of server options, including
    ++	unknown ones, is server-specific.
     +	When multiple `--server-option=<option>` are given, they are all
     +	sent to the other side in the order listed on the command line.
     +
    @@ -48,8 +66,8 @@
      		   N_("separate git dir from working tree")),
      	OPT_STRING_LIST('c', "config", &option_config, N_("key=value"),
      			N_("set config inside the new repository")),
    -+	OPT_STRING_LIST(0, "server-option", &server_options, N_("server-specific"),
    -+			N_("option to transmit")),
    ++	OPT_STRING_LIST(0, "server-option", &server_options,
    ++			N_("server-specific"), N_("option to transmit")),
      	OPT_SET_INT('4', "ipv4", &family, N_("use IPv4 addresses only"),
      			TRANSPORT_FAMILY_IPV4),
      	OPT_SET_INT('6', "ipv6", &family, N_("use IPv6 addresses only"),
    @@ -68,7 +86,7 @@
      --- a/t/t5702-protocol-v2.sh
      +++ b/t/t5702-protocol-v2.sh
     @@
    - 	grep "server-option=world" log
    + 	grep "Ignoring server options" err
      '
      
     +test_expect_success 'server-options are sent when cloning' '
    @@ -81,6 +99,16 @@
     +	grep "server-option=hello" log &&
     +	grep "server-option=world" log
     +'
    ++
    ++test_expect_success 'warn if using server-option with clone with legacy protocol' '
    ++	test_when_finished "rm -rf myclone" &&
    ++
    ++	GIT_TEST_PROTOCOL_VERSION=0 git -c protocol.version=0 \
    ++		clone --server-option=hello --server-option=world \
    ++		"file://$(pwd)/file_parent" myclone 2>err &&
    ++
    ++	grep "Ignoring server options" err
    ++'
     +
      test_expect_success 'upload-pack respects config using protocol v2' '
      	git init server &&
-- 
2.21.0.392.gf8f6787159e-goog
Previous: Jonathan TanNext: Jonathan Tan
Message 6 of 22 in “clone: send server options when using protocol v2”
  1. clone: send server options when using protocol v2Jonathan Tan, Apr 5, 2019
  2. Jonathan NiederApr 6, 2019
  3. Jonathan TanApr 8, 2019
  4. Junio C HamanoApr 9, 2019
  5. Jonathan TanApr 9, 2019
  6. 0/2 Server options when cloningJonathan Tan, Apr 9, 2019
  7. 1/2 transport: warn if server options are unsupportedJonathan Tan, Apr 9, 2019
  8. Jonathan NiederApr 9, 2019
  9. Junio C HamanoApr 10, 2019
  10. 2/2 clone: send server options when using protocol v2Jonathan Tan, Apr 9, 2019
  11. Jonathan NiederApr 9, 2019
  12. 0/2 Server options when cloningJonathan Tan, Apr 11, 2019
  13. 1/2 transport: warn if server options are unsupportedJonathan Tan, Apr 11, 2019
  14. Junio C HamanoApr 12, 2019
  15. 2/2 clone: send server options when using protocol v2Jonathan Tan, Apr 11, 2019
  16. 0/2 Server options when cloningJonathan Tan, Apr 12, 2019
  17. 1/2 transport: die if server options are unsupportedJonathan Tan, Apr 12, 2019
  18. SZEDER GáborApr 12, 2019
  19. Re* [PATCH v4 1/2] transport: die if server options are unsupportedJunio C Hamano, Apr 15, 2019
  20. Junio C HamanoApr 15, 2019
  21. SZEDER GáborApr 15, 2019
  22. 2/2 clone: send server options when using protocol v2Jonathan Tan, Apr 12, 2019

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.