@@ -39,25 +39,45 @@ communicates with that invoked process over the SSH connection.
39
39
The file:// transport runs the 'upload-pack' or 'receive-pack'
40
40
process locally and communicates with it over a pipe.
41
41
42
+ Extra Parameters
43
+ ----------------
44
+
45
+ The protocol provides a mechanism in which clients can send additional
46
+ information in its first message to the server. These are called "Extra
47
+ Parameters", and are supported by the Git, SSH, and HTTP protocols.
48
+
49
+ Each Extra Parameter takes the form of `<key>=<value>` or `<key>`.
50
+
51
+ Servers that receive any such Extra Parameters MUST ignore all
52
+ unrecognized keys. Currently, the only Extra Parameter recognized is
53
+ "version=1".
54
+
42
55
Git Transport
43
56
-------------
44
57
45
58
The Git transport starts off by sending the command and repository
46
59
on the wire using the pkt-line format, followed by a NUL byte and a
47
60
hostname parameter, terminated by a NUL byte.
48
61
49
- 0032git-upload-pack /project.git\0host=myserver.com\0
62
+ 0033git-upload-pack /project.git\0host=myserver.com\0
63
+
64
+ The transport may send Extra Parameters by adding an additional NUL
65
+ byte, and then adding one or more NUL-terminated strings:
66
+
67
+ 003egit-upload-pack /project.git\0host=myserver.com\0\0version=1\0
50
68
51
69
--
52
- git-proto-request = request-command SP pathname NUL [ host-parameter NUL ]
70
+ git-proto-request = request-command SP pathname NUL
71
+ [ host-parameter NUL ] [ NUL extra-parameters ]
53
72
request-command = "git-upload-pack" / "git-receive-pack" /
54
73
"git-upload-archive" ; case sensitive
55
74
pathname = *( %x01-ff ) ; exclude NUL
56
75
host-parameter = "host=" hostname [ ":" port ]
76
+ extra-parameters = 1*extra-parameter
77
+ extra-parameter = 1*( %x01-ff ) NUL
57
78
--
58
79
59
- Only host-parameter is allowed in the git-proto-request. Clients
60
- MUST NOT attempt to send additional parameters. It is used for the
80
+ host-parameter is used for the
61
81
git-daemon name based virtual hosting. See --interpolated-path
62
82
option to git daemon, with the %H/%CH format characters.
63
83
@@ -117,6 +137,12 @@ we execute it without the leading '/'.
117
137
v
118
138
ssh
[email protected] "git-upload-pack '~alice/project.git'"
119
139
140
+ Depending on the value of the `protocol.version` configuration variable,
141
+ Git may attempt to send Extra Parameters as a colon-separated string in
142
+ the GIT_PROTOCOL environment variable. This is done only if
143
+ the `ssh.variant` configuration variable indicates that the ssh command
144
+ supports passing environment variables as an argument.
145
+
120
146
A few things to remember here:
121
147
122
148
- The "command name" is spelled with dash (e.g. git-upload-pack), but
@@ -137,11 +163,13 @@ Reference Discovery
137
163
-------------------
138
164
139
165
When the client initially connects the server will immediately respond
140
- with a listing of each reference it has (all branches and tags) along
166
+ with a version number (if "version=1" is sent as an Extra Parameter),
167
+ and a listing of each reference it has (all branches and tags) along
141
168
with the object name that each reference currently points to.
142
169
143
- $ echo -e -n "0039git -upload-pack /schacon/gitbook.git\0host=example.com\0" |
170
+ $ echo -e -n "0044git -upload-pack /schacon/gitbook.git\0host=example.com\0\0version=1 \0" |
144
171
nc -v example.com 9418
172
+ 000aversion 1
145
173
00887217a7c7e582c46cec22a130adf4b9d7d950fba0 HEAD\0multi_ack thin-pack
146
174
side-band side-band-64k ofs-delta shallow no-progress include-tag
147
175
00441d3fcd5ced445d1abc402225c0b8a1299641f497 refs/heads/integration
@@ -165,7 +193,8 @@ immediately after the ref itself, if presented. A conforming server
165
193
MUST peel the ref if it's an annotated tag.
166
194
167
195
----
168
- advertised-refs = (no-refs / list-of-refs)
196
+ advertised-refs = *1("version 1")
197
+ (no-refs / list-of-refs)
169
198
*shallow
170
199
flush-pkt
171
200
0 commit comments