Merge branch 'jc/archive'
authorJunio C Hamano <junkio@cox.net>
Sun, 17 Sep 2006 09:46:00 +0000 (02:46 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 17 Sep 2006 09:46:00 +0000 (02:46 -0700)
* jc/archive:
git-tar-tree: devolve git-tar-tree into a wrapper for git-archive
git-archive: inline default_parse_extra()
builtin-archive.c: rename remote_request() to extract_remote_arg()
upload-archive: monitor child communication more carefully.
Add sideband status report to git-archive protocol
Prepare larger packet buffer for upload-pack protocol.
Teach --exec to git-archive --remote
Add --verbose to git-archive
archive: force line buffered output to stderr
Use xstrdup instead of strdup in builtin-{tar,zip}-tree.c
Move sideband server side support into reusable form.
Move sideband client side support into reusable form.
archive: allow remote to have more formats than we understand.
git-archive: make compression level of ZIP archives configurable
Add git-upload-archive
git-archive: wire up ZIP format.
git-archive: wire up TAR format.
Add git-archive

1  2 
Makefile
builtin.h
fetch-pack.c
git.c
diff --combined Makefile
index b9938acd48545e6d55dcc5fbe0719043d4b27250,c724b481a4426ed3336c12289eafdcb581c09e42..b98745045cef3a5f8db62ee58cd5f936c13e0f5a
+++ b/Makefile
@@@ -126,8 -126,6 +126,8 @@@ GITWEB_CONFIG = gitweb_config.per
  GITWEB_HOME_LINK_STR = projects
  GITWEB_SITENAME =
  GITWEB_PROJECTROOT = /pub/git
 +GITWEB_EXPORT_OK =
 +GITWEB_STRICT_EXPORT =
  GITWEB_BASE_URL =
  GITWEB_LIST =
  GITWEB_HOMETEXT = indextext.html
@@@ -234,8 -232,8 +234,8 @@@ LIB_FILE=libgit.
  XDIFF_LIB=xdiff/lib.a
  
  LIB_H = \
-       blob.h cache.h commit.h csum-file.h delta.h \
-       diff.h object.h pack.h pkt-line.h quote.h refs.h \
+       archive.h blob.h cache.h commit.h csum-file.h delta.h \
+       diff.h object.h pack.h pkt-line.h quote.h refs.h sideband.h \
        run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
        tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h
  
@@@ -247,7 -245,7 +247,7 @@@ DIFF_OBJS = 
  LIB_OBJS = \
        blob.o commit.o connect.o csum-file.o cache-tree.o base85.o \
        date.o diff-delta.o entry.o exec_cmd.o ident.o lockfile.o \
-       object.o pack-check.o patch-delta.o path.o pkt-line.o \
+       object.o pack-check.o patch-delta.o path.o pkt-line.o sideband.o \
        quote.o read-cache.o refs.o run-command.o dir.o object-refs.o \
        server-info.o setup.o sha1_file.o sha1_name.o strbuf.o \
        tag.o tree.o usage.o config.o environment.o ctype.o copy.o \
  BUILTIN_OBJS = \
        builtin-add.o \
        builtin-apply.o \
+       builtin-archive.o \
        builtin-cat-file.o \
        builtin-checkout-index.o \
        builtin-check-ref-format.o \
        builtin-unpack-objects.o \
        builtin-update-index.o \
        builtin-update-ref.o \
+       builtin-upload-archive.o \
        builtin-upload-tar.o \
        builtin-verify-pack.o \
        builtin-write-tree.o \
@@@ -633,8 -633,6 +635,8 @@@ gitweb/gitweb.cgi: gitweb/gitweb.per
            -e 's|++GITWEB_HOME_LINK_STR++|$(GITWEB_HOME_LINK_STR)|g' \
            -e 's|++GITWEB_SITENAME++|$(GITWEB_SITENAME)|g' \
            -e 's|++GITWEB_PROJECTROOT++|$(GITWEB_PROJECTROOT)|g' \
 +          -e 's|++GITWEB_EXPORT_OK++|$(GITWEB_EXPORT_OK)|g' \
 +          -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
            -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
            -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
            -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
diff --combined builtin.h
index 398eafbf995e4bf7a999ea9ff0e573c55e39790b,6bfd2e79f5d88313ae38fed4544b434540acf427..37a8c875a8ff26e6550aec21655020694b118ea5
+++ b/builtin.h
@@@ -1,7 -1,8 +1,7 @@@
  #ifndef BUILTIN_H
  #define BUILTIN_H
  
 -#include <stdio.h>
 -#include <limits.h>
 +#include "git-compat-util.h"
  
  extern const char git_version_string[];
  extern const char git_usage_string[];
@@@ -14,6 -15,7 +14,7 @@@ extern int write_tree(unsigned char *sh
  
  extern int cmd_add(int argc, const char **argv, const char *prefix);
  extern int cmd_apply(int argc, const char **argv, const char *prefix);
+ extern int cmd_archive(int argc, const char **argv, const char *prefix);
  extern int cmd_cat_file(int argc, const char **argv, const char *prefix);
  extern int cmd_checkout_index(int argc, const char **argv, const char *prefix);
  extern int cmd_check_ref_format(int argc, const char **argv, const char *prefix);
@@@ -55,6 -57,7 +56,7 @@@ extern int cmd_zip_tree(int argc, cons
  extern int cmd_unpack_objects(int argc, const char **argv, const char *prefix);
  extern int cmd_update_index(int argc, const char **argv, const char *prefix);
  extern int cmd_update_ref(int argc, const char **argv, const char *prefix);
+ extern int cmd_upload_archive(int argc, const char **argv, const char *prefix);
  extern int cmd_upload_tar(int argc, const char **argv, const char *prefix);
  extern int cmd_version(int argc, const char **argv, const char *prefix);
  extern int cmd_whatchanged(int argc, const char **argv, const char *prefix);
diff --combined fetch-pack.c
index 1b4d8272dce834d10b16ecbcea7ae2fa974fc856,1b2d6ee20d16d03a59d2cd2aafb46e9a03c492b0..e8708aa802b8e09d8044bb99dbccb0fecdb14481
@@@ -166,10 -166,11 +166,11 @@@ static int find_common(int fd[2], unsig
                }
  
                if (!fetching)
-                       packet_write(fd[1], "want %s%s%s%s\n",
+                       packet_write(fd[1], "want %s%s%s%s%s\n",
                                     sha1_to_hex(remote),
                                     (multi_ack ? " multi_ack" : ""),
-                                    (use_sideband ? " side-band" : ""),
+                                    (use_sideband == 2 ? " side-band-64k" : ""),
+                                    (use_sideband == 1 ? " side-band" : ""),
                                     (use_thin_pack ? " thin-pack" : ""));
                else
                        packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
@@@ -426,7 -427,12 +427,12 @@@ static int fetch_pack(int fd[2], int nr
                        fprintf(stderr, "Server supports multi_ack\n");
                multi_ack = 1;
        }
-       if (server_supports("side-band")) {
+       if (server_supports("side-band-64k")) {
+               if (verbose)
+                       fprintf(stderr, "Server supports side-band-64k\n");
+               use_sideband = 2;
+       }
+       else if (server_supports("side-band")) {
                if (verbose)
                        fprintf(stderr, "Server supports side-band\n");
                use_sideband = 1;
@@@ -519,7 -525,7 +525,7 @@@ int main(int argc, char **argv
        ret = fetch_pack(fd, nr_heads, heads);
        close(fd[0]);
        close(fd[1]);
 -      finish_connect(pid);
 +      ret |= finish_connect(pid);
  
        if (!ret && nr_heads) {
                /* If the heads to pull were given, we should have
                        }
        }
  
 -      return ret;
 +      return !!ret;
  }
diff --combined git.c
index 8c182a5f5581d345e7bf69116f42fa3af089b2d5,bcf3fc8444cf911866805dc84dadab04eae48fae..70cafb02625016943f03622ff37949d8f64cdcfb
--- 1/git.c
--- 2/git.c
+++ b/git.c
@@@ -220,11 -220,12 +220,12 @@@ static void handle_internal_command(in
        } commands[] = {
                { "add", cmd_add, RUN_SETUP },
                { "apply", cmd_apply },
+               { "archive", cmd_archive },
                { "cat-file", cmd_cat_file, RUN_SETUP },
                { "checkout-index", cmd_checkout_index, RUN_SETUP },
                { "check-ref-format", cmd_check_ref_format },
                { "commit-tree", cmd_commit_tree, RUN_SETUP },
 -              { "count-objects", cmd_count_objects },
 +              { "count-objects", cmd_count_objects, RUN_SETUP },
                { "diff", cmd_diff, RUN_SETUP },
                { "diff-files", cmd_diff_files, RUN_SETUP },
                { "diff-index", cmd_diff_index, RUN_SETUP },
                { "unpack-objects", cmd_unpack_objects, RUN_SETUP },
                { "update-index", cmd_update_index, RUN_SETUP },
                { "update-ref", cmd_update_ref, RUN_SETUP },
+               { "upload-archive", cmd_upload_archive },
                { "upload-tar", cmd_upload_tar },
                { "version", cmd_version },
                { "whatchanged", cmd_whatchanged, RUN_SETUP | USE_PAGER },
  
  int main(int argc, const char **argv, char **envp)
  {
 -      const char *cmd = argv[0];
 +      const char *cmd = argv[0] ? argv[0] : "git-help";
        char *slash = strrchr(cmd, '/');
        const char *exec_path = NULL;
        int done_alias = 0;