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

Re: [PATCH] Documentation: document Extra Parameters

From
BWBrandon Williams <bmwill@google.com>
Date
Oct 13, 2017, 22:26 UTC
Message-ID
<20171013222601.GC101395@google.com>
In-Reply-To
<20171010193956.168385-1-jonathantanmy@google.com>
On 10/10, Jonathan Tan wrote:
Show 11 quoted lines
> Document the server support for Extra Parameters, additional information
> that the client can send in its first message to the server during a
> Git client-server interaction.
> 
> Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
> ---
> I noticed that Documentation/technical was not updated in this patch
> series. It probably should, and here is a suggestion on how to do it.
> 
> Also, I'm not sure what to call the extra sendable information. I'm open
> to suggestions for a better name than Extra Parameters.
Thanks for writing this up.
Show 72 quoted lines
> ---
>  Documentation/technical/http-protocol.txt |  8 ++++++
>  Documentation/technical/pack-protocol.txt | 43 ++++++++++++++++++++++++++-----
>  2 files changed, 44 insertions(+), 7 deletions(-)
> 
> diff --git a/Documentation/technical/http-protocol.txt b/Documentation/technical/http-protocol.txt
> index 1c561bdd9..a0e45f288 100644
> --- a/Documentation/technical/http-protocol.txt
> +++ b/Documentation/technical/http-protocol.txt
> @@ -219,6 +219,10 @@ smart server reply:
>     S: 003c2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0\n
>     S: 003fa3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}\n
>  
> +The client may send Extra Parameters (see
> +Documentation/technical/pack-protocol.txt) as a colon-separated string
> +in the Git-Protocol HTTP header.
> +
>  Dumb Server Response
>  ^^^^^^^^^^^^^^^^^^^^
>  Dumb servers MUST respond with the dumb server reply format.
> @@ -269,7 +273,11 @@ the C locale ordering.  The stream SHOULD include the default ref
>  named `HEAD` as the first ref.  The stream MUST include capability
>  declarations behind a NUL on the first ref.
>  
> +The returned response contains "version 1" if "version=1" was sent as an
> +Extra Parameter.
> +
>    smart_reply     =  PKT-LINE("# service=$servicename" LF)
> +		     *1("version 1")
>  		     ref_list
>  		     "0000"
>    ref_list        =  empty_list / non_empty_list
> diff --git a/Documentation/technical/pack-protocol.txt b/Documentation/technical/pack-protocol.txt
> index ed1eae8b8..f9ebfb23e 100644
> --- a/Documentation/technical/pack-protocol.txt
> +++ b/Documentation/technical/pack-protocol.txt
> @@ -39,6 +39,19 @@ communicates with that invoked process over the SSH connection.
>  The file:// transport runs the 'upload-pack' or 'receive-pack'
>  process locally and communicates with it over a pipe.
>  
> +Extra Parameters
> +----------------
> +
> +The protocol provides a mechanism in which clients can send additional
> +information in its first message to the server. These are called "Extra
> +Parameters", and are supported by the Git, SSH, and HTTP protocols.
> +
> +Each Extra Parameter takes the form of `<key>=<value>` or `<key>`.
> +
> +Servers that receive any such Extra Parameters MUST ignore all
> +unrecognized keys. Currently, the only Extra Parameter recognized is
> +"version=1".
> +
>  Git Transport
>  -------------
>  
> @@ -46,18 +59,25 @@ The Git transport starts off by sending the command and repository
>  on the wire using the pkt-line format, followed by a NUL byte and a
>  hostname parameter, terminated by a NUL byte.
>  
> -   0032git-upload-pack /project.git\0host=myserver.com\0
> +   0033git-upload-pack /project.git\0host=myserver.com\0
> +
> +The transport may send Extra Parameters by adding an additional NUL
> +byte, and then adding one or more NUL-terminated strings:
> +
> +   003egit-upload-pack /project.git\0host=myserver.com\0\0version=1\0
>  
>  --
> -   git-proto-request = request-command SP pathname NUL [ host-parameter NUL ]
> +   git-proto-request = request-command SP pathname NUL
> +		       [ host-parameter NUL [ NUL extra-parameters ] ]

This should probably be "[ host-parameter NUL ] [ NUL extra-parameters ]" because we don't want to require sending a host parameter in order to send extra parameters.

Show 56 quoted lines
>     request-command   = "git-upload-pack" / "git-receive-pack" /
>  		       "git-upload-archive"   ; case sensitive
>     pathname          = *( %x01-ff ) ; exclude NUL
>     host-parameter    = "host=" hostname [ ":" port ]
> +   extra-parameters  = 1*extra-parameter
> +   extra-parameter   = 1*( %x01-ff ) NUL
>  --
>  
> -Only host-parameter is allowed in the git-proto-request. Clients
> -MUST NOT attempt to send additional parameters. It is used for the
> +host-parameter is used for the
>  git-daemon name based virtual hosting.  See --interpolated-path
>  option to git daemon, with the %H/%CH format characters.
>  
> @@ -117,6 +137,12 @@ we execute it without the leading '/'.
>  		     v
>     ssh user@example.com "git-upload-pack '~alice/project.git'"
>  
> +Depending on the value of the `protocol.version` configuration variable,
> +Git may attempt to send Extra Parameters as a colon-separated string in
> +the GIT_PROTOCOL environment variable. This is done only if
> +the `ssh.variant` configuration variable indicates that the ssh command
> +supports passing environment variables as an argument.
> +
>  A few things to remember here:
>  
>  - The "command name" is spelled with dash (e.g. git-upload-pack), but
> @@ -137,11 +163,13 @@ Reference Discovery
>  -------------------
>  
>  When the client initially connects the server will immediately respond
> -with a listing of each reference it has (all branches and tags) along
> +with a version number (if "version=1" is sent as an Extra Parameter),
> +and a listing of each reference it has (all branches and tags) along
>  with the object name that each reference currently points to.
>  
> -   $ echo -e -n "0039git-upload-pack /schacon/gitbook.git\0host=example.com\0" |
> +   $ echo -e -n "0044git-upload-pack /schacon/gitbook.git\0host=example.com\0\0version=1\0" |
>        nc -v example.com 9418
> +   000aversion 1
>     00887217a7c7e582c46cec22a130adf4b9d7d950fba0 HEAD\0multi_ack thin-pack
>  		side-band side-band-64k ofs-delta shallow no-progress include-tag
>     00441d3fcd5ced445d1abc402225c0b8a1299641f497 refs/heads/integration
> @@ -165,7 +193,8 @@ immediately after the ref itself, if presented. A conforming server
>  MUST peel the ref if it's an annotated tag.
>  
>  ----
> -  advertised-refs  =  (no-refs / list-of-refs)
> +  advertised-refs  =  *1("version 1")
> +		      (no-refs / list-of-refs)
>  		      *shallow
>  		      flush-pkt
>  
> -- 
> 2.14.2.920.gcf0c67979c-goog
> 
-- 
Brandon Williams
Previous: Jonathan TanNext: Brandon Williams
Message 148 of 161 in “protocol transition”
  1. 0/8 protocol transitionBrandon Williams, Sep 13, 2017
  2. 1/8 pkt-line: add packet_write functionBrandon Williams, Sep 13, 2017
  3. 2/8 protocol: introduce protocol extention mechanismsBrandon Williams, Sep 13, 2017
  4. Stefan BellerSep 13, 2017
  5. Brandon WilliamsSep 18, 2017
  6. Stefan BellerSep 18, 2017
  7. Brandon WilliamsSep 18, 2017
  8. Stefan BellerSep 18, 2017
  9. 3/8 daemon: recognize hidden request argumentsBrandon Williams, Sep 13, 2017
  10. Stefan BellerSep 13, 2017
  11. Brandon WilliamsSep 18, 2017
  12. Jonathan TanSep 21, 2017
  13. Jonathan TanSep 21, 2017
  14. Brandon WilliamsSep 21, 2017
  15. 5/8 connect: teach client to recognize v1 server responseBrandon Williams, Sep 13, 2017
  16. 4/8 upload-pack, receive-pack: introduce protocol version 1Brandon Williams, Sep 13, 2017
  17. 6/8 connect: tell server that the client understands v1Brandon Williams, Sep 13, 2017
  18. 8/8 i5700: add interop test for protocol transitionBrandon Williams, Sep 13, 2017
  19. 7/8 http: tell server that the client understands v1Brandon Williams, Sep 13, 2017
  20. 5/8 connect: die when a capability line comes after a refBrandon Williams, Sep 20, 2017
  21. Jeff KingSep 20, 2017
  22. Brandon WilliamsSep 20, 2017
  23. Jonathan NiederSep 20, 2017
  24. Junio C HamanoSep 21, 2017
  25. connect: in ref advertisement, shallows are lastJonathan Tan, Sep 21, 2017
  26. connect: in ref advertisement, shallows are lastJonathan Tan, Sep 21, 2017
  27. Brandon WilliamsSep 22, 2017
  28. connect: in ref advertisement, shallows are lastJonathan Tan, Sep 22, 2017
  29. Junio C HamanoSep 22, 2017
  30. Junio C HamanoSep 22, 2017
  31. Brandon WilliamsSep 22, 2017
  32. connect: in ref advertisement, shallows are lastJonathan Tan, Sep 22, 2017
  33. Brandon WilliamsSep 22, 2017
  34. Jonathan TanSep 22, 2017
  35. Junio C HamanoSep 24, 2017
  36. connect: in ref advertisement, shallows are lastJonathan Tan, Sep 26, 2017
  37. Brandon WilliamsSep 26, 2017
  38. 0/9 protocol transitionBrandon Williams, Sep 26, 2017
  39. 2/9 pkt-line: add packet_write functionBrandon Williams, Sep 26, 2017
  40. 3/9 protocol: introduce protocol extention mechanismsBrandon Williams, Sep 26, 2017
  41. Junio C HamanoSep 27, 2017
  42. Junio C HamanoSep 27, 2017
  43. Brandon WilliamsSep 29, 2017
  44. Brandon WilliamsSep 28, 2017
  45. Stefan BellerSep 27, 2017
  46. Brandon WilliamsSep 28, 2017
  47. 1/9 connect: in ref advertisement, shallows are lastBrandon Williams, Sep 26, 2017
  48. 6/9 connect: teach client to recognize v1 server responseBrandon Williams, Sep 26, 2017
  49. Junio C HamanoSep 27, 2017
  50. Brandon WilliamsSep 27, 2017
  51. Junio C HamanoSep 27, 2017
  52. Brandon WilliamsSep 28, 2017
  53. 7/9 connect: tell server that the client understands v1Brandon Williams, Sep 26, 2017
  54. Junio C HamanoSep 27, 2017
  55. Junio C HamanoSep 27, 2017
  56. Brandon WilliamsSep 29, 2017
  57. Brandon WilliamsSep 28, 2017
  58. 9/9 i5700: add interop test for protocol transitionBrandon Williams, Sep 26, 2017
  59. 8/9 http: tell server that the client understands v1Brandon Williams, Sep 26, 2017
  60. Junio C HamanoSep 27, 2017
  61. Brandon WilliamsSep 27, 2017
  62. 5/9 upload-pack, receive-pack: introduce protocol version 1Brandon Williams, Sep 26, 2017
  63. Junio C HamanoSep 27, 2017
  64. Brandon WilliamsSep 27, 2017
  65. 4/9 daemon: recognize hidden request argumentsBrandon Williams, Sep 26, 2017
  66. Junio C HamanoSep 27, 2017
  67. Brandon WilliamsSep 27, 2017
  68. Brandon WilliamsSep 28, 2017
  69. 00/10 protocol transitionBrandon Williams, Oct 3, 2017
  70. 04/10 daemon: recognize hidden request argumentsBrandon Williams, Oct 3, 2017
  71. Jonathan TanOct 10, 2017
  72. Brandon WilliamsOct 13, 2017
  73. 03/10 protocol: introduce protocol extention mechanismsBrandon Williams, Oct 3, 2017
  74. Simon RuderichOct 6, 2017
  75. Junio C HamanoOct 6, 2017
  76. Martin ÅgrenOct 6, 2017
  77. Junio C HamanoOct 6, 2017
  78. Martin ÅgrenOct 6, 2017
  79. Stefan BellerOct 6, 2017
  80. Martin ÅgrenOct 8, 2017
  81. Brandon WilliamsOct 10, 2017
  82. Jonathan NiederOct 10, 2017
  83. Stefan BellerOct 10, 2017
  84. Junio C HamanoOct 11, 2017
  85. Brandon WilliamsOct 13, 2017
  86. Martin ÅgrenOct 9, 2017
  87. Jonathan TanOct 10, 2017
  88. 02/10 pkt-line: add packet_write functionBrandon Williams, Oct 3, 2017
  89. Jonathan TanOct 10, 2017
  90. 05/10 upload-pack, receive-pack: introduce protocol version 1Brandon Williams, Oct 3, 2017
  91. Jonathan TanOct 10, 2017
  92. Brandon WilliamsOct 13, 2017
  93. 01/10 connect: in ref advertisement, shallows are lastBrandon Williams, Oct 3, 2017
  94. Jonathan TanOct 10, 2017
  95. 09/10 i5700: add interop test for protocol transitionBrandon Williams, Oct 3, 2017
  96. 08/10 http: tell server that the client understands v1Brandon Williams, Oct 3, 2017
  97. 10/10 ssh: introduce a 'simple' ssh variantBrandon Williams, Oct 3, 2017
  98. Jonathan NiederOct 3, 2017
  99. Brandon WilliamsOct 16, 2017
  100. 0/5 Coping with unrecognized ssh wrapper scripts in GIT_SSHJonathan Nieder, Oct 23, 2017
  101. 1/5 connect: split git:// setup into a separate functionJonathan Nieder, Oct 23, 2017
  102. Stefan BellerOct 23, 2017
  103. diff: add option to ignore whitespaces for move detection onlyStefan Beller, Oct 24, 2017
  104. Brandon WilliamsOct 24, 2017
  105. Junio C HamanoOct 25, 2017
  106. Junio C HamanoOct 25, 2017
  107. Brandon WilliamsOct 25, 2017
  108. Junio C HamanoOct 24, 2017
  109. Stefan BellerOct 24, 2017
  110. 2/5 connect: split ssh command line options into separate functionJonathan Nieder, Oct 23, 2017
  111. Stefan BellerOct 23, 2017
  112. 3/5 ssh: 'auto' variant to select between 'ssh' and 'simple'Jonathan Nieder, Oct 23, 2017
  113. Jonathan TanOct 23, 2017
  114. Jonathan NiederOct 23, 2017
  115. Brandon WilliamsOct 23, 2017
  116. Jonathan TanOct 23, 2017
  117. 0/5 Coping with unrecognized ssh wrapper scripts in GIT_SSHJonathan Nieder, Oct 23, 2017
  118. 1/5 connect: split git:// setup into a separate functionJonathan Nieder, Oct 23, 2017
  119. Junio C HamanoOct 24, 2017
  120. Jonathan NiederNov 15, 2017
  121. Junio C HamanoNov 17, 2017
  122. 2/5 connect: split ssh command line options into separate functionJonathan Nieder, Oct 23, 2017
  123. Junio C HamanoOct 24, 2017
  124. 3/5 ssh: 'auto' variant to select between 'ssh' and 'simple'Jonathan Nieder, Oct 23, 2017
  125. Brandon WilliamsOct 23, 2017
  126. Stefan BellerOct 23, 2017
  127. 4/5 ssh: 'simple' variant does not support -4/-6Jonathan Nieder, Oct 23, 2017
  128. 5/5 ssh: 'simple' variant does not support --portJonathan Nieder, Oct 23, 2017
  129. Junio C HamanoOct 24, 2017
  130. Jonathan NiederOct 23, 2017
  131. Stefan BellerOct 23, 2017
  132. Jonathan NiederOct 23, 2017
  133. Junio C HamanoOct 24, 2017
  134. Johannes SchindelinOct 25, 2017
  135. Stefan BellerOct 25, 2017
  136. Jonathan NiederOct 25, 2017
  137. Junio C HamanoOct 30, 2017
  138. Johannes SchindelinOct 30, 2017
  139. 4/5 ssh: 'simple' variant does not support -4/-6Jonathan Nieder, Oct 23, 2017
  140. 5/5 ssh: 'simple' variant does not support --portJonathan Nieder, Oct 23, 2017
  141. Stefan BellerOct 23, 2017
  142. 07/10 connect: tell server that the client understands v1Brandon Williams, Oct 3, 2017
  143. Jonathan TanOct 10, 2017
  144. Brandon WilliamsOct 13, 2017
  145. 06/10 connect: teach client to recognize v1 server responseBrandon Williams, Oct 3, 2017
  146. Junio C HamanoOct 4, 2017
  147. Documentation: document Extra ParametersJonathan Tan, Oct 10, 2017
  148. Brandon WilliamsOct 13, 2017
  149. 00/11 protocol transitionBrandon Williams, Oct 16, 2017
  150. 01/11 connect: in ref advertisement, shallows are lastBrandon Williams, Oct 16, 2017
  151. 02/11 pkt-line: add packet_write functionBrandon Williams, Oct 16, 2017
  152. 03/11 protocol: introduce protocol extension mechanismsBrandon Williams, Oct 16, 2017
  153. Kevin DaudtOct 16, 2017
  154. 06/11 connect: teach client to recognize v1 server responseBrandon Williams, Oct 16, 2017
  155. 04/11 daemon: recognize hidden request argumentsBrandon Williams, Oct 16, 2017
  156. 09/11 i5700: add interop test for protocol transitionBrandon Williams, Oct 16, 2017
  157. 08/11 http: tell server that the client understands v1Brandon Williams, Oct 16, 2017
  158. 05/11 upload-pack, receive-pack: introduce protocol version 1Brandon Williams, Oct 16, 2017
  159. 07/11 connect: tell server that the client understands v1Brandon Williams, Oct 16, 2017
  160. 10/11 ssh: introduce a 'simple' ssh variantBrandon Williams, Oct 16, 2017
  161. 11/11 Documentation: document Extra ParametersBrandon Williams, Oct 16, 2017

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.