remote-curl: store the protocol version the server responded with
Store the protocol version the server responded with when performing discovery. This will be used in a future patch to either change the 'Git-Protocol' header sent in subsequent requests or to determine if a client needs to fallback to using a different protocol version. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Williams committed
Mar 15, 2018 at 10:31 UTC
49e85e95006e6a8e544372e529834319fcb0987c
1 file changed
+3
-1
remote-curl.c
+3
-1
@@ -171,6 +171,7 @@ struct discovery {
171
size_t len;
172
struct ref *refs;
173
struct oid_array shallow;
174
+ enum protocol_version version;
175
unsigned proto_git : 1;
176
};
177
static struct discovery *last_discovery;
@@ -184,7 +185,8 @@ static struct ref *parse_git_refs(struct discovery *heads, int for_push)
185
PACKET_READ_CHOMP_NEWLINE |
186
PACKET_READ_GENTLE_ON_EOF);
187
187
- switch (discover_version(&reader)) {
188
+ heads->version = discover_version(&reader);
189
+ switch (heads->version) {
190
case protocol_v2:
191
die("support for protocol v2 not implemented yet");
192
break;