Skip to content

Commit

Permalink
Remove git-zip-tree
Browse files Browse the repository at this point in the history
git-zip-tree can be safely removed because it was never part of a formal
release.  This patch makes 'git-archive --format=zip' the one and only git
ZIP file creation command.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Rene Scharfe authored and Junio C Hamano committed Sep 23, 2006
1 parent 3d5c0cc commit 31756c5
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 135 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 0 additions & 67 deletions Documentation/git-zip-tree.txt

This file was deleted.

65 changes: 0 additions & 65 deletions builtin-zip-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit 31756c5

Please sign in to comment.