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:
Junio C Hamano
2024-01-30 13:34:12 -08:00
4 changed files with 68 additions and 22 deletions

View File

@@ -1446,8 +1446,14 @@ static int stateless_connect(const char *service_name)
* establish a stateless connection, otherwise we need to tell the
* client to fallback to using other transport helper functions to
* complete their request.
*
* The "git-upload-archive" service is a read-only operation. Fallback
* to use "git-upload-pack" service to discover protocol version.
*/
discover = discover_refs(service_name, 0);
if (!strcmp(service_name, "git-upload-archive"))
discover = discover_refs("git-upload-pack", 0);
else
discover = discover_refs(service_name, 0);
if (discover->version != protocol_v2) {
printf("fallback\n");
fflush(stdout);
@@ -1485,9 +1491,11 @@ static int stateless_connect(const char *service_name)
/*
* Dump the capability listing that we got from the server earlier
* during the info/refs request.
* during the info/refs request. This does not work with the
* "git-upload-archive" service.
*/
write_or_die(rpc.in, discover->buf, discover->len);
if (strcmp(service_name, "git-upload-archive"))
write_or_die(rpc.in, discover->buf, discover->len);
/* Until we see EOF keep sending POSTs */
while (1) {