diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Documentation/git-zip-tree.txt | 67 | ||||
-rw-r--r-- | builtin-zip-tree.c | 65 | ||||
-rw-r--r-- | builtin.h | 1 | ||||
-rw-r--r-- | git.c | 1 |
5 files changed, 0 insertions, 135 deletions
diff --git a/.gitignore b/.gitignore index a3d9c7a11..3ca66e42f 100644 --- a/.gitignore +++ b/.gitignore @@ -128,7 +128,6 @@ git-verify-pack git-verify-tag git-whatchanged git-write-tree -git-zip-tree git-core-*/?* gitweb/gitweb.cgi test-date diff --git a/Documentation/git-zip-tree.txt b/Documentation/git-zip-tree.txt deleted file mode 100644 index 2e9d98124..000000000 --- a/Documentation/git-zip-tree.txt +++ /dev/null @@ -1,67 +0,0 @@ -git-zip-tree(1) -=============== - -NAME ----- -git-zip-tree - Creates a ZIP archive of the files in the named tree - - -SYNOPSIS --------- -'git-zip-tree' [-0|...|-9] <tree-ish> [ <base> ] - -DESCRIPTION ------------ -Creates a ZIP archive containing the tree structure for the named tree. -When <base> is specified it is added as a leading path to the files in the -generated ZIP archive. - -git-zip-tree behaves differently when given a tree ID versus when given -a commit ID or tag ID. In the first case the current time is used as -modification time of each file in the archive. In the latter case the -commit time as recorded in the referenced commit object is used instead. -Additionally the commit ID is stored as an archive comment. - -Currently git-zip-tree can handle only files and directories, symbolic -links are not supported. - -OPTIONS -------- - --0:: - Store the files instead of deflating them. - --9:: - Highest and slowest compression level. You can specify any - number from 1 to 9 to adjust compression speed and ratio. - -<tree-ish>:: - The tree or commit to produce ZIP archive for. If it is - the object name of a commit object. - -<base>:: - Leading path to the files in the resulting ZIP archive. - -EXAMPLES --------- -git zip-tree v1.4.0 git-1.4.0 >git-1.4.0.zip:: - - Create a ZIP file for v1.4.0 release. - -git zip-tree HEAD:Documentation/ git-docs >docs.zip:: - - Put everything in the current head's Documentation/ directory - into 'docs.zip', with the prefix 'git-docs/'. - -Author ------- -Written by Rene Scharfe. - -Documentation --------------- -Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>. - -GIT ---- -Part of the gitlink:git[7] suite - diff --git a/builtin-zip-tree.c b/builtin-zip-tree.c index 52d4b7a17..3ffdad68d 100644 --- a/builtin-zip-tree.c +++ b/builtin-zip-tree.c @@ -10,9 +10,6 @@ #include "builtin.h" #include "archive.h" -static const char zip_tree_usage[] = -"git-zip-tree [-0|...|-9] <tree-ish> [ <base> ]"; - static int verbose; static int zip_date; static int zip_time; @@ -294,68 +291,6 @@ static void dos_time(time_t *time, int *dos_date, int *dos_time) *dos_time = t->tm_sec / 2 + t->tm_min * 32 + t->tm_hour * 2048; } -int cmd_zip_tree(int argc, const char **argv, const char *prefix) -{ - unsigned char sha1[20]; - struct tree *tree; - struct commit *commit; - time_t archive_time; - char *base; - int baselen; - - git_config(git_default_config); - - if (argc > 1 && argv[1][0] == '-') { - if (isdigit(argv[1][1]) && argv[1][2] == '\0') { - zlib_compression_level = argv[1][1] - '0'; - argc--; - argv++; - } - } - - switch (argc) { - case 3: - base = xstrdup(argv[2]); - baselen = strlen(base); - break; - case 2: - base = xstrdup(""); - baselen = 0; - break; - default: - usage(zip_tree_usage); - } - - if (get_sha1(argv[1], sha1)) - die("Not a valid object name %s", argv[1]); - - commit = lookup_commit_reference_gently(sha1, 1); - archive_time = commit ? commit->date : time(NULL); - dos_time(&archive_time, &zip_date, &zip_time); - - zip_dir = xmalloc(ZIP_DIRECTORY_MIN_SIZE); - zip_dir_size = ZIP_DIRECTORY_MIN_SIZE; - - tree = parse_tree_indirect(sha1); - if (!tree) - die("not a tree object"); - - if (baselen > 0) { - write_zip_entry(tree->object.sha1, "", 0, base, 040777, 0); - base = xrealloc(base, baselen + 1); - base[baselen] = '/'; - baselen++; - base[baselen] = '\0'; - } - read_tree_recursive(tree, base, baselen, 0, NULL, write_zip_entry); - write_zip_trailer(commit ? commit->object.sha1 : NULL); - - free(zip_dir); - free(base); - - return 0; -} - int write_zip_archive(struct archiver_args *args) { int plen = strlen(args->base); @@ -53,7 +53,6 @@ extern int cmd_show(int argc, const char **argv, const char *prefix); extern int cmd_stripspace(int argc, const char **argv, const char *prefix); extern int cmd_symbolic_ref(int argc, const char **argv, const char *prefix); extern int cmd_tar_tree(int argc, const char **argv, const char *prefix); -extern int cmd_zip_tree(int argc, const char **argv, const char *prefix); 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); @@ -259,7 +259,6 @@ static void handle_internal_command(int argc, const char **argv, char **envp) { "stripspace", cmd_stripspace }, { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP }, { "tar-tree", cmd_tar_tree, RUN_SETUP }, - { "zip-tree", cmd_zip_tree, RUN_SETUP }, { "unpack-objects", cmd_unpack_objects, RUN_SETUP }, { "update-index", cmd_update_index, RUN_SETUP }, { "update-ref", cmd_update_ref, RUN_SETUP }, |