From b236752a8722c77b5a9b4ed488a992ee05252843 Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 9 Dec 2009 17:26:33 +0200 Subject: Support remote archive from all smart transports Previously, remote archive required internal (non remote-helper) smart transport. Extend the remote archive to also support smart transports implemented by remote helpers. Signed-off-by: Ilari Liusvaara Signed-off-by: Junio C Hamano --- transport-helper.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'transport-helper.c') diff --git a/transport-helper.c b/transport-helper.c index 50b3bac0c..6ece0d987 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -467,6 +467,24 @@ static int process_connect(struct transport *transport, return process_connect_service(transport, name, exec); } +static int connect_helper(struct transport *transport, const char *name, + const char *exec, int fd[2]) +{ + struct helper_data *data = transport->data; + + /* Get_helper so connect is inited. */ + get_helper(transport); + if (!data->connect) + die("Operation not supported by protocol."); + + if (!process_connect_service(transport, name, exec)) + die("Can't connect to subservice %s.", name); + + fd[0] = data->helper->out; + fd[1] = data->helper->in; + return 0; +} + static int fetch(struct transport *transport, int nr_heads, struct ref **to_fetch) { @@ -711,6 +729,7 @@ int transport_helper_init(struct transport *transport, const char *name) transport->fetch = fetch; transport->push_refs = push_refs; transport->disconnect = release_helper; + transport->connect = connect_helper; transport->smart_options = &(data->transport_options); return 0; } -- cgit v1.2.1