@matheusbsbs / matheus-bagliano / commits / fe5ab763f8
Fork 0

Teach --exec to git-archive --remote

Some people needed --exec to specify the location of the upload-pack executable, because their default SSH log-in does not include the directory they have their own private copy of git on the $PATH. These people need to be able to say --exec to git-archive --remote for the same reason. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Sep 10, 2006 at 04:02 UTC fe5ab763f848cfcda22001f9280625f06c4c3760
1 file changed +17 -3
builtin-archive.c
+17 -3
@@ -32,16 +32,30 @@ static int run_remote_archiver(const char *remote, int argc,
32 char *url, buf[1024];
33 int fd[2], i, len, rv;
34 pid_t pid;
35 + const char *exec = "git-upload-archive";
36 + int exec_at = 0;
37
36 - sprintf(buf, "git-upload-archive");
38 + for (i = 1; i < argc; i++) {
39 + const char *arg = argv[i];
40 + if (!strncmp("--exec=", arg, 7)) {
41 + if (exec_at)
42 + die("multiple --exec specified");
43 + exec = arg + 7;
44 + exec_at = i;
45 + break;
46 + }
47 + }
48
49 url = xstrdup(remote);
39 - pid = git_connect(fd, url, buf);
50 + pid = git_connect(fd, url, exec);
51 if (pid < 0)
52 return pid;
53
43 - for (i = 1; i < argc; i++)
54 + for (i = 1; i < argc; i++) {
55 + if (i == exec_at)
56 + continue;
57 packet_write(fd[1], "argument %s\n", argv[i]);
58 + }
59 packet_flush(fd[1]);
60
61 len = packet_read_line(fd[0], buf, sizeof(buf));