trace: Fixed a minor typo in an error message.
[gitweb.git] / builtin-archive.c
index 4dd2716c0f8cd41425ecc51f85a7dbdd0511c41b..5ceec433fd590e8bf6a51700ea69c37f9af30fa7 100644 (file)
@@ -15,7 +15,7 @@ static int run_remote_archiver(const char *remote, int argc,
        int fd[2], i, len, rv;
        struct child_process *conn;
        const char *exec = "git-upload-archive";
-       int exec_at = 0;
+       int exec_at = 0, exec_value_at = 0;
 
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
@@ -24,7 +24,14 @@ static int run_remote_archiver(const char *remote, int argc,
                                die("multiple --exec specified");
                        exec = arg + 7;
                        exec_at = i;
-                       break;
+               } else if (!strcmp(arg, "--exec")) {
+                       if (exec_at)
+                               die("multiple --exec specified");
+                       if (i + 1 >= argc)
+                               die("option --exec requires a value");
+                       exec = argv[i + 1];
+                       exec_at = i;
+                       exec_value_at = ++i;
                }
        }
 
@@ -32,7 +39,7 @@ static int run_remote_archiver(const char *remote, int argc,
        conn = git_connect(fd, url, exec, 0);
 
        for (i = 1; i < argc; i++) {
-               if (i == exec_at)
+               if (i == exec_at || i == exec_value_at)
                        continue;
                packet_write(fd[1], "argument %s\n", argv[i]);
        }
@@ -40,18 +47,18 @@ static int run_remote_archiver(const char *remote, int argc,
 
        len = packet_read_line(fd[0], buf, sizeof(buf));
        if (!len)
-               die("git-archive: expected ACK/NAK, got EOF");
+               die("git archive: expected ACK/NAK, got EOF");
        if (buf[len-1] == '\n')
                buf[--len] = 0;
        if (strcmp(buf, "ACK")) {
                if (len > 5 && !prefixcmp(buf, "NACK "))
-                       die("git-archive: NACK %s", buf + 5);
-               die("git-archive: protocol error");
+                       die("git archive: NACK %s", buf + 5);
+               die("git archive: protocol error");
        }
 
        len = packet_read_line(fd[0], buf, sizeof(buf));
        if (len)
-               die("git-archive: expected a flush");
+               die("git archive: expected a flush");
 
        /* Now, start reading from fd[0] and spit it out to stdout */
        rv = recv_sideband("archive", fd[0], 1, 2);
@@ -78,6 +85,13 @@ static const char *extract_remote_arg(int *ac, const char **av)
                                        die("Multiple --remote specified");
                                remote = arg + 9;
                                continue;
+                       } else if (!strcmp(arg, "--remote")) {
+                               if (remote)
+                                       die("Multiple --remote specified");
+                               if (++ix >= cnt)
+                                       die("option --remote requires a value");
+                               remote = av[ix];
+                               continue;
                        }
                        if (arg[0] != '-')
                                no_more_options = 1;