tar-tree: remove deprecated command

"git tar-tree" has been a thin wrapper around "git archive" since commit fd88d9c (Remove upload-tar and make git-tar-tree a thin wrapper to git-archive, 2006-09-24), which also made it print a message indicating that git-tar-tree is deprecated. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Nov 10, 2013 at 15:47 UTC 925ceccf050e2998c2b805476b529bdf5352cf74
9 files changed +5 -173
.gitignore
-1
@@ -158,7 +158,6 @@
158 /git-svn
159 /git-symbolic-ref
160 /git-tag
161 -/git-tar-tree
161 /git-unpack-file
162 /git-unpack-objects
163 /git-update-index
Documentation/git-tar-tree.txt deleted
-82
@@ -1,82 +0,0 @@
1 -git-tar-tree(1)
2 -===============
3 -
4 -NAME
5 -----
6 -git-tar-tree - Create a tar archive of the files in the named tree object
7 -
8 -
9 -SYNOPSIS
10 ---------
11 -[verse]
12 -'git tar-tree' [--remote=<repo>] <tree-ish> [ <base> ]
13 -
14 -DESCRIPTION
15 ------------
16 -THIS COMMAND IS DEPRECATED. Use 'git archive' with `--format=tar`
17 -option instead (and move the <base> argument to `--prefix=base/`).
18 -
19 -Creates a tar archive containing the tree structure for the named tree.
20 -When <base> is specified it is added as a leading path to the files in the
21 -generated tar archive.
22 -
23 -'git tar-tree' behaves differently when given a tree ID versus when given
24 -a commit ID or tag ID. In the first case the current time is used as
25 -modification time of each file in the archive. In the latter case the
26 -commit time as recorded in the referenced commit object is used instead.
27 -Additionally the commit ID is stored in a global extended pax header.
28 -It can be extracted using 'git get-tar-commit-id'.
29 -
30 -OPTIONS
31 --------
32 -
33 -<tree-ish>::
34 - The tree or commit to produce tar archive for. If it is
35 - the object name of a commit object.
36 -
37 -<base>::
38 - Leading path to the files in the resulting tar archive.
39 -
40 ---remote=<repo>::
41 - Instead of making a tar archive from local repository,
42 - retrieve a tar archive from a remote repository.
43 -
44 -CONFIGURATION
45 --------------
46 -
47 -tar.umask::
48 - This variable can be used to restrict the permission bits of
49 - tar archive entries. The default is 0002, which turns off the
50 - world write bit. The special value "user" indicates that the
51 - archiving user's umask will be used instead. See umask(2) for
52 - details.
53 -
54 -EXAMPLES
55 ---------
56 -`git tar-tree HEAD junk | (cd /var/tmp/ && tar xf -)`::
57 -
58 - Create a tar archive that contains the contents of the
59 - latest commit on the current branch, and extracts it in
60 - `/var/tmp/junk` directory.
61 -
62 -`git tar-tree v1.4.0 git-1.4.0 | gzip >git-1.4.0.tar.gz`::
63 -
64 - Create a tarball for v1.4.0 release.
65 -
66 -`git tar-tree v1.4.0^{tree} git-1.4.0 | gzip >git-1.4.0.tar.gz`::
67 -
68 - Create a tarball for v1.4.0 release, but without a
69 - global extended pax header.
70 -
71 -`git tar-tree --remote=example.com:git.git v1.4.0 >git-1.4.0.tar`::
72 -
73 - Get a tarball v1.4.0 from example.com.
74 -
75 -`git tar-tree HEAD:Documentation/ git-docs > git-1.4.0-docs.tar`::
76 -
77 - Put everything in the current head's Documentation/ directory
78 - into 'git-1.4.0-docs.tar', with the prefix 'git-docs/'.
79 -
80 -GIT
81 ----
82 -Part of the linkgit:git[1] suite
builtin/tar-tree.c
-62
@@ -7,71 +7,9 @@
7 #include "builtin.h"
8 #include "quote.h"
9
10 -static const char tar_tree_usage[] =
11 -"git tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
12 -"*** Note that this command is now deprecated; use \"git archive\" instead.";
13 -
10 static const char builtin_get_tar_commit_id_usage[] =
11 "git get-tar-commit-id < <tarfile>";
12
17 -int cmd_tar_tree(int argc, const char **argv, const char *prefix)
18 -{
19 - /*
20 - * "git tar-tree" is now a wrapper around "git archive --format=tar"
21 - *
22 - * $0 --remote=<repo> arg... ==>
23 - * git archive --format=tar --remote=<repo> arg...
24 - * $0 tree-ish ==>
25 - * git archive --format=tar tree-ish
26 - * $0 tree-ish basedir ==>
27 - * git archive --format-tar --prefix=basedir tree-ish
28 - */
29 - const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
30 - struct strbuf sb = STRBUF_INIT;
31 - char *basedir_arg;
32 - int nargc = 0;
33 -
34 - nargv[nargc++] = "archive";
35 - nargv[nargc++] = "--format=tar";
36 -
37 - if (2 <= argc && !prefixcmp(argv[1], "--remote=")) {
38 - nargv[nargc++] = argv[1];
39 - argv++;
40 - argc--;
41 - }
42 -
43 - /*
44 - * Because it's just a compatibility wrapper, tar-tree supports only
45 - * the old behaviour of reading attributes from the work tree.
46 - */
47 - nargv[nargc++] = "--worktree-attributes";
48 -
49 - switch (argc) {
50 - default:
51 - usage(tar_tree_usage);
52 - break;
53 - case 3:
54 - /* base-path */
55 - basedir_arg = xmalloc(strlen(argv[2]) + 11);
56 - sprintf(basedir_arg, "--prefix=%s/", argv[2]);
57 - nargv[nargc++] = basedir_arg;
58 - /* fallthru */
59 - case 2:
60 - /* tree-ish */
61 - nargv[nargc++] = argv[1];
62 - }
63 - nargv[nargc] = NULL;
64 -
65 - fprintf(stderr,
66 - "*** \"git tar-tree\" is now deprecated.\n"
67 - "*** Running \"git archive\" instead.\n***");
68 - sq_quote_argv(&sb, nargv, 0);
69 - strbuf_addch(&sb, '\n');
70 - fputs(sb.buf, stderr);
71 - strbuf_release(&sb);
72 - return cmd_archive(nargc, nargv, prefix);
73 -}
74 -
13 /* ustar header + extended global header content */
14 #define RECORDSIZE (512)
15 #define HEADERSIZE (2 * RECORDSIZE)
command-list.txt
-1
@@ -126,7 +126,6 @@ git-submodule mainporcelain
126 git-svn foreignscminterface
127 git-symbolic-ref plumbingmanipulators
128 git-tag mainporcelain common
129 -git-tar-tree plumbinginterrogators deprecated
129 git-unpack-file plumbinginterrogators
130 git-unpack-objects plumbingmanipulators
131 git-update-index plumbingmanipulators
contrib/completion/git-completion.bash
-1
@@ -706,7 +706,6 @@ __git_list_porcelain_commands ()
706 ssh-*) : transport;;
707 stripspace) : plumbing;;
708 symbolic-ref) : plumbing;;
709 - tar-tree) : deprecated;;
709 unpack-file) : plumbing;;
710 unpack-objects) : plumbing;;
711 update-index) : plumbing;;
git.c
-1
@@ -437,7 +437,6 @@ static void handle_internal_command(int argc, const char **argv)
437 { "stripspace", cmd_stripspace },
438 { "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
439 { "tag", cmd_tag, RUN_SETUP },
440 - { "tar-tree", cmd_tar_tree },
440 { "unpack-file", cmd_unpack_file, RUN_SETUP },
441 { "unpack-objects", cmd_unpack_objects, RUN_SETUP },
442 { "update-index", cmd_update_index, RUN_SETUP },
t/t4116-apply-reverse.sh
+2 -2
@@ -48,12 +48,12 @@ test_expect_success 'apply in reverse' '
48
49 test_expect_success 'setup separate repository lacking postimage' '
50
51 - git tar-tree initial initial | $TAR xf - &&
51 + git archive --format=tar --prefix=initial/ initial | $TAR xf - &&
52 (
53 cd initial && git init && git add .
54 ) &&
55
56 - git tar-tree second second | $TAR xf - &&
56 + git archive --format=tar --prefix=second/ second | $TAR xf - &&
57 (
58 cd second && git init && git add .
59 )
t/t5000-tar-tree.sh
+3 -13
@@ -3,7 +3,7 @@
3 # Copyright (C) 2005 Rene Scharfe
4 #
5
6 -test_description='git tar-tree and git get-tar-commit-id test
6 +test_description='git archive and git get-tar-commit-id test
7
8 This test covers the topics of file contents, commit date handling and
9 commit id embedding:
@@ -13,11 +13,11 @@ commit id embedding:
13 binary file (/bin/sh). Only paths shorter than 99 characters are
14 used.
15
16 - git tar-tree applies the commit date to every file in the archive it
16 + git archive applies the commit date to every file in the archive it
17 creates. The test sets the commit date to a specific value and checks
18 if the tar archive contains that value.
19
20 - When giving git tar-tree a commit id (in contrast to a tree id) it
20 + When giving git archive a commit id (in contrast to a tree id) it
21 embeds this commit id into the tar archive as a comment. The test
22 checks the ability of git get-tar-commit-id to figure it out from the
23 tar file.
@@ -196,16 +196,6 @@ test_expect_success \
196 'git get-tar-commit-id <b.tar >b.commitid &&
197 test_cmp .git/$(git symbolic-ref HEAD) b.commitid'
198
199 -test_expect_success 'git tar-tree' '
200 - git tar-tree HEAD >tar-tree.tar &&
201 - test_cmp b.tar tar-tree.tar
202 -'
203 -
204 -test_expect_success 'git tar-tree with prefix' '
205 - git tar-tree HEAD prefix >tar-tree_with_prefix.tar &&
206 - test_cmp with_prefix.tar tar-tree_with_prefix.tar
207 -'
208 -
199 test_expect_success 'git archive with --output, override inferred format' '
200 git archive --format=tar --output=d4.zip HEAD &&
201 test_cmp b.tar d4.zip
t/t5001-archive-attr.sh
-10
@@ -87,14 +87,4 @@ test_expect_success 'export-subst' '
87 test_cmp substfile2 archive/substfile2
88 '
89
90 -test_expect_success 'git tar-tree vs. git archive with worktree attributes' '
91 - git tar-tree HEAD >tar-tree.tar &&
92 - test_cmp worktree.tar tar-tree.tar
93 -'
94 -
95 -test_expect_success 'git tar-tree vs. git archive with worktree attrs, bare' '
96 - (cd bare && git tar-tree HEAD) >bare-tar-tree.tar &&
97 - test_cmp bare-worktree.tar bare-tar-tree.tar
98 -'
99 -
90 test_done