mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
Merge branch 'jx/remote-archive-over-smart-http'
"git archive --remote=<remote>" learned to talk over the smart http (aka stateless) transport. * jx/remote-archive-over-smart-http: transport-helper: call do_take_over() in process_connect transport-helper: call do_take_over() in connect_helper http-backend: new rpc-service for git-upload-archive transport-helper: protocol v2 supports upload-archive remote-curl: supports git-upload-archive service transport-helper: no connection restriction in connect_helper
This commit is contained in:
@@ -626,7 +626,8 @@ static int process_connect_service(struct transport *transport,
|
||||
ret = run_connect(transport, &cmdbuf);
|
||||
} else if (data->stateless_connect &&
|
||||
(get_protocol_version_config() == protocol_v2) &&
|
||||
!strcmp("git-upload-pack", name)) {
|
||||
(!strcmp("git-upload-pack", name) ||
|
||||
!strcmp("git-upload-archive", name))) {
|
||||
strbuf_addf(&cmdbuf, "stateless-connect %s\n", name);
|
||||
ret = run_connect(transport, &cmdbuf);
|
||||
if (ret)
|
||||
@@ -643,6 +644,7 @@ static int process_connect(struct transport *transport,
|
||||
struct helper_data *data = transport->data;
|
||||
const char *name;
|
||||
const char *exec;
|
||||
int ret;
|
||||
|
||||
name = for_push ? "git-receive-pack" : "git-upload-pack";
|
||||
if (for_push)
|
||||
@@ -650,7 +652,10 @@ static int process_connect(struct transport *transport,
|
||||
else
|
||||
exec = data->transport_options.uploadpack;
|
||||
|
||||
return process_connect_service(transport, name, exec);
|
||||
ret = process_connect_service(transport, name, exec);
|
||||
if (ret)
|
||||
do_take_over(transport);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int connect_helper(struct transport *transport, const char *name,
|
||||
@@ -660,14 +665,14 @@ static int connect_helper(struct transport *transport, const char *name,
|
||||
|
||||
/* 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;
|
||||
|
||||
do_take_over(transport);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -682,10 +687,8 @@ static int fetch_refs(struct transport *transport,
|
||||
|
||||
get_helper(transport);
|
||||
|
||||
if (process_connect(transport, 0)) {
|
||||
do_take_over(transport);
|
||||
if (process_connect(transport, 0))
|
||||
return transport->vtable->fetch_refs(transport, nr_heads, to_fetch);
|
||||
}
|
||||
|
||||
/*
|
||||
* If we reach here, then the server, the client, and/or the transport
|
||||
@@ -1142,10 +1145,8 @@ static int push_refs(struct transport *transport,
|
||||
{
|
||||
struct helper_data *data = transport->data;
|
||||
|
||||
if (process_connect(transport, 1)) {
|
||||
do_take_over(transport);
|
||||
if (process_connect(transport, 1))
|
||||
return transport->vtable->push_refs(transport, remote_refs, flags);
|
||||
}
|
||||
|
||||
if (!remote_refs) {
|
||||
fprintf(stderr,
|
||||
@@ -1186,11 +1187,9 @@ static struct ref *get_refs_list(struct transport *transport, int for_push,
|
||||
{
|
||||
get_helper(transport);
|
||||
|
||||
if (process_connect(transport, for_push)) {
|
||||
do_take_over(transport);
|
||||
if (process_connect(transport, for_push))
|
||||
return transport->vtable->get_refs_list(transport, for_push,
|
||||
transport_options);
|
||||
}
|
||||
|
||||
return get_refs_list_using_list(transport, for_push);
|
||||
}
|
||||
@@ -1274,10 +1273,8 @@ static int get_bundle_uri(struct transport *transport)
|
||||
{
|
||||
get_helper(transport);
|
||||
|
||||
if (process_connect(transport, 0)) {
|
||||
do_take_over(transport);
|
||||
if (process_connect(transport, 0))
|
||||
return transport->vtable->get_bundle_uri(transport);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user