aboutsummaryrefslogtreecommitdiff
path: root/builtin-archive.c
diff options
context:
space:
mode:
authorIlari Liusvaara <ilari.liusvaara@elisanet.fi>2009-12-09 17:26:33 +0200
committerJunio C Hamano <gitster@pobox.com>2009-12-28 00:24:15 -0800
commitb236752a8722c77b5a9b4ed488a992ee05252843 (patch)
tree4035f35d52c4e5a24c0dd3ddddcac76bcae6dc04 /builtin-archive.c
parentfa8c097cc9b416283ae4c1c1507909ff207b7f60 (diff)
downloadgit-b236752a8722c77b5a9b4ed488a992ee05252843.tar.gz
git-b236752a8722c77b5a9b4ed488a992ee05252843.tar.xz
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 <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-archive.c')
-rw-r--r--builtin-archive.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/builtin-archive.c b/builtin-archive.c
index 12351e9dd..d34b3fd02 100644
--- a/builtin-archive.c
+++ b/builtin-archive.c
@@ -5,6 +5,7 @@
#include "cache.h"
#include "builtin.h"
#include "archive.h"
+#include "transport.h"
#include "parse-options.h"
#include "pkt-line.h"
#include "sideband.h"
@@ -25,12 +26,16 @@ static void create_output_file(const char *output_file)
static int run_remote_archiver(int argc, const char **argv,
const char *remote, const char *exec)
{
- char *url, buf[LARGE_PACKET_MAX];
+ char buf[LARGE_PACKET_MAX];
int fd[2], i, len, rv;
- struct child_process *conn;
+ struct transport *transport;
+ struct remote *_remote;
- url = xstrdup(remote);
- conn = git_connect(fd, url, exec, 0);
+ _remote = remote_get(remote);
+ if (!_remote->url[0])
+ die("git archive: Remote with no URL");
+ transport = transport_get(_remote, _remote->url[0]);
+ transport_connect(transport, "git-upload-archive", exec, fd);
for (i = 1; i < argc; i++)
packet_write(fd[1], "argument %s\n", argv[i]);
@@ -53,9 +58,7 @@ static int run_remote_archiver(int argc, const char **argv,
/* Now, start reading from fd[0] and spit it out to stdout */
rv = recv_sideband("archive", fd[0], 1);
- close(fd[0]);
- close(fd[1]);
- rv |= finish_connect(conn);
+ rv |= transport_disconnect(transport);
return !!rv;
}