From ad6ac1244fd175d08bcee62060a9a0b7975930fb Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Wed, 14 Mar 2018 11:31:45 -0700 Subject: connect: discover protocol version outside of get_remote_heads In order to prepare for the addition of protocol_v2 push the protocol version discovery outside of 'get_remote_heads()'. This will allow for keeping the logic for processing the reference advertisement for protocol_v1 and protocol_v0 separate from the logic for protocol_v2. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- connect.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'connect.h') diff --git a/connect.h b/connect.h index 01f14cdf3f..cdb8979dce 100644 --- a/connect.h +++ b/connect.h @@ -13,4 +13,7 @@ extern int parse_feature_request(const char *features, const char *feature); extern const char *server_feature_value(const char *feature, int *len_ret); extern int url_is_local_not_ssh(const char *url); +struct packet_reader; +extern enum protocol_version discover_version(struct packet_reader *reader); + #endif -- cgit v1.2.3 From e52449b672210f4b49e116ca34dcd46657287f61 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 15 Mar 2018 10:31:21 -0700 Subject: connect: request remote refs using v2 Teach the client to be able to request a remote's refs using protocol v2. This is done by having a client issue a 'ls-refs' request to a v2 server. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- connect.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'connect.h') diff --git a/connect.h b/connect.h index cdb8979dce..8898d44952 100644 --- a/connect.h +++ b/connect.h @@ -16,4 +16,6 @@ extern int url_is_local_not_ssh(const char *url); struct packet_reader; extern enum protocol_version discover_version(struct packet_reader *reader); +extern int server_supports_v2(const char *c, int die_on_error); + #endif -- cgit v1.2.3 From f7e205010542dc9b712473d260058e43ca2b26f7 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Thu, 15 Mar 2018 10:31:29 -0700 Subject: fetch-pack: support shallow requests Enable shallow clones and deepen requests using protocol version 2 if the server 'fetch' command supports the 'shallow' feature. Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- connect.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'connect.h') diff --git a/connect.h b/connect.h index 8898d44952..0e69c6709c 100644 --- a/connect.h +++ b/connect.h @@ -17,5 +17,7 @@ struct packet_reader; extern enum protocol_version discover_version(struct packet_reader *reader); extern int server_supports_v2(const char *c, int die_on_error); +extern int server_supports_feature(const char *c, const char *feature, + int die_on_error); #endif -- cgit v1.2.3