Code

builtin-apply: keep information about files to be deleted
[git.git] / builtin-upload-archive.c
index 371400d49a5ff9f6ce297d7af07eb3fd6426c9ee..0206b416cbf08ae4c1b0d753784fb0b61bac46a1 100644 (file)
@@ -8,22 +8,21 @@
 #include "sideband.h"
 
 static const char upload_archive_usage[] =
-       "git-upload-archive <repo>";
+       "git upload-archive <repo>";
 
 static const char deadchild[] =
-"git-upload-archive: archiver died with error";
+"git upload-archive: archiver died with error";
 
 static const char lostchild[] =
-"git-upload-archive: archiver process was lost";
+"git upload-archive: archiver process was lost";
 
+#define MAX_ARGS (64)
 
 static int run_upload_archive(int argc, const char **argv, const char *prefix)
 {
-       struct archiver ar;
        const char *sent_argv[MAX_ARGS];
        const char *arg_cmd = "argument ";
        char *p, buf[4096];
-       int treeish_idx;
        int sent_argc;
        int len;
 
@@ -36,7 +35,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
        strcpy(buf, argv[1]); /* enter-repo smudges its argument */
 
        if (!enter_repo(buf, 0))
-               die("not a git archive");
+               die("'%s' does not appear to be a git repository", buf);
 
        /* put received options in sent_argv[] */
        sent_argc = 1;
@@ -47,7 +46,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
                if (len == 0)
                        break;  /* got a flush */
                if (sent_argc > MAX_ARGS - 2)
-                       die("Too many options (>29)");
+                       die("Too many options (>%d)", MAX_ARGS - 2);
 
                if (p[len-1] == '\n') {
                        p[--len] = 0;
@@ -65,12 +64,7 @@ static int run_upload_archive(int argc, const char **argv, const char *prefix)
        sent_argv[sent_argc] = NULL;
 
        /* parse all options sent by the client */
-       treeish_idx = parse_archive_args(sent_argc, sent_argv, &ar);
-
-       parse_treeish_arg(sent_argv + treeish_idx, &ar.args, prefix);
-       parse_pathspec_arg(sent_argv + treeish_idx + 1, &ar.args);
-
-       return ar.write_archive(&ar.args);
+       return write_archive(sent_argc, sent_argv, prefix, 0);
 }
 
 static void error_clnt(const char *fmt, ...)