From: Junio C Hamano Date: Sun, 17 Sep 2006 09:46:00 +0000 (-0700) Subject: Merge branch 'jc/archive' X-Git-Tag: v1.4.3-rc1~90 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/4d69065d3adad480b79831ca9f08536aaf563dba?ds=inline;hp=-c Merge branch 'jc/archive' * 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 --- 4d69065d3adad480b79831ca9f08536aaf563dba diff --combined Makefile index b9938acd48,c724b481a4..b98745045c --- a/Makefile +++ 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 \ @@@ -258,6 -256,7 +258,7 @@@ BUILTIN_OBJS = \ builtin-add.o \ builtin-apply.o \ + builtin-archive.o \ builtin-cat-file.o \ builtin-checkout-index.o \ builtin-check-ref-format.o \ @@@ -294,6 -293,7 +295,7 @@@ 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 398eafbf99,6bfd2e79f5..37a8c875a8 --- a/builtin.h +++ b/builtin.h @@@ -1,7 -1,8 +1,7 @@@ #ifndef BUILTIN_H #define BUILTIN_H -#include -#include +#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 1b4d8272dc,1b2d6ee20d..e8708aa802 --- a/fetch-pack.c +++ b/fetch-pack.c @@@ -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 @@@ -534,5 -540,5 +540,5 @@@ } } - return ret; + return !!ret; } diff --combined git.c index 8c182a5f55,bcf3fc8444..70cafb0262 --- a/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 }, @@@ -261,6 -262,7 +262,7 @@@ { "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 }, @@@ -294,7 -296,7 +296,7 @@@ 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;