Signed-off-by: Stefan Beller <[email protected]>
---
connect.c | 28 ++++++++++++++++++++++++++++
remote.h | 1 +
2 files changed, 29 insertions(+)
diff --git a/connect.c b/connect.c
index 4ebe1dc..752b9a5 100644
--- a/connect.c
+++ b/connect.c
@@ -126,6 +126,34 @@ void get_remote_capabilities(int in, char *src_buf, size_t
src_len)
}
}
+/* just select all options the server advertised. */
+void preselect_capabilities(struct transport_options *options)
+{
+ if (is_repository_shallow() && !server_supports("shallow"))
+ die("Server does not support shallow clients");
+
+ if (server_supports("multi_ack"))
+ options->multi_ack = 1;
+ else if (server_supports("multi_ack_detailed"))
+ options->multi_ack = 2;
+
+ if (server_supports("side-band"))
+ options->use_sideband = 1;
+ else if (server_supports("side-band-64k"))
+ options->use_sideband = 2;
+
+ if (server_supports("no-done"))
+ options->no_done = 1;
+ if (server_supports("thin-pack"))
+ options->use_thin_pack = 1;
+ if (server_supports("no-progress"))
+ options->no_progress = 1;
+ if (server_supports("include-tag"))
+ options->include_tag = 1;
+ if (server_supports("ofs-delta"))
+ options->prefer_ofs_delta = 1;
+}
+
int request_capabilities(int out, struct transport_options *options)
{
if (options->multi_ack == 2) packet_write(out, "multi_ack_detailed");
diff --git a/remote.h b/remote.h
index 61619c5..264a513 100644
--- a/remote.h
+++ b/remote.h
@@ -166,6 +166,7 @@ extern void get_remote_heads(int in, char *src_buf, size_t
src_len,
struct sha1_array *shallow);
void get_remote_capabilities(int in, char *src_buf, size_t src_len);
+void preselect_capabilities(struct transport_options *options);
int request_capabilities(int out, struct transport_options*);
int resolve_remote_symref(struct ref *ref, struct ref *list);
--
2.4.1.345.gab207b6.dirty
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html