Skip to content

Commit

Permalink
tar-tree: remove deprecated command
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
johnkeeping authored and gitster committed Nov 12, 2013
1 parent eb8e7e1 commit 925cecc
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 173 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
/git-svn
/git-symbolic-ref
/git-tag
/git-tar-tree
/git-unpack-file
/git-unpack-objects
/git-update-index
Expand Down
82 changes: 0 additions & 82 deletions Documentation/git-tar-tree.txt

This file was deleted.

62 changes: 0 additions & 62 deletions builtin/tar-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,71 +7,9 @@
#include "builtin.h"
#include "quote.h"

static const char tar_tree_usage[] =
"git tar-tree [--remote=<repo>] <tree-ish> [basedir]\n"
"*** Note that this command is now deprecated; use \"git archive\" instead.";

static const char builtin_get_tar_commit_id_usage[] =
"git get-tar-commit-id < <tarfile>";

int cmd_tar_tree(int argc, const char **argv, const char *prefix)
{
/*
* "git tar-tree" is now a wrapper around "git archive --format=tar"
*
* $0 --remote=<repo> arg... ==>
* git archive --format=tar --remote=<repo> arg...
* $0 tree-ish ==>
* git archive --format=tar tree-ish
* $0 tree-ish basedir ==>
* git archive --format-tar --prefix=basedir tree-ish
*/
const char **nargv = xcalloc(sizeof(*nargv), argc + 3);
struct strbuf sb = STRBUF_INIT;
char *basedir_arg;
int nargc = 0;

nargv[nargc++] = "archive";
nargv[nargc++] = "--format=tar";

if (2 <= argc && !prefixcmp(argv[1], "--remote=")) {
nargv[nargc++] = argv[1];
argv++;
argc--;
}

/*
* Because it's just a compatibility wrapper, tar-tree supports only
* the old behaviour of reading attributes from the work tree.
*/
nargv[nargc++] = "--worktree-attributes";

switch (argc) {
default:
usage(tar_tree_usage);
break;
case 3:
/* base-path */
basedir_arg = xmalloc(strlen(argv[2]) + 11);
sprintf(basedir_arg, "--prefix=%s/", argv[2]);
nargv[nargc++] = basedir_arg;
/* fallthru */
case 2:
/* tree-ish */
nargv[nargc++] = argv[1];
}
nargv[nargc] = NULL;

fprintf(stderr,
"*** \"git tar-tree\" is now deprecated.\n"
"*** Running \"git archive\" instead.\n***");
sq_quote_argv(&sb, nargv, 0);
strbuf_addch(&sb, '\n');
fputs(sb.buf, stderr);
strbuf_release(&sb);
return cmd_archive(nargc, nargv, prefix);
}

/* ustar header + extended global header content */
#define RECORDSIZE (512)
#define HEADERSIZE (2 * RECORDSIZE)
Expand Down
1 change: 0 additions & 1 deletion command-list.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ git-submodule mainporcelain
git-svn foreignscminterface
git-symbolic-ref plumbingmanipulators
git-tag mainporcelain common
git-tar-tree plumbinginterrogators deprecated
git-unpack-file plumbinginterrogators
git-unpack-objects plumbingmanipulators
git-update-index plumbingmanipulators
Expand Down
1 change: 0 additions & 1 deletion contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -706,7 +706,6 @@ __git_list_porcelain_commands ()
ssh-*) : transport;;
stripspace) : plumbing;;
symbolic-ref) : plumbing;;
tar-tree) : deprecated;;
unpack-file) : plumbing;;
unpack-objects) : plumbing;;
update-index) : plumbing;;
Expand Down
1 change: 0 additions & 1 deletion git.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ static void handle_internal_command(int argc, const char **argv)
{ "stripspace", cmd_stripspace },
{ "symbolic-ref", cmd_symbolic_ref, RUN_SETUP },
{ "tag", cmd_tag, RUN_SETUP },
{ "tar-tree", cmd_tar_tree },
{ "unpack-file", cmd_unpack_file, RUN_SETUP },
{ "unpack-objects", cmd_unpack_objects, RUN_SETUP },
{ "update-index", cmd_update_index, RUN_SETUP },
Expand Down
4 changes: 2 additions & 2 deletions t/t4116-apply-reverse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ test_expect_success 'apply in reverse' '

test_expect_success 'setup separate repository lacking postimage' '
git tar-tree initial initial | $TAR xf - &&
git archive --format=tar --prefix=initial/ initial | $TAR xf - &&
(
cd initial && git init && git add .
) &&
git tar-tree second second | $TAR xf - &&
git archive --format=tar --prefix=second/ second | $TAR xf - &&
(
cd second && git init && git add .
)
Expand Down
16 changes: 3 additions & 13 deletions t/t5000-tar-tree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright (C) 2005 Rene Scharfe
#

test_description='git tar-tree and git get-tar-commit-id test
test_description='git archive and git get-tar-commit-id test
This test covers the topics of file contents, commit date handling and
commit id embedding:
Expand All @@ -13,11 +13,11 @@ commit id embedding:
binary file (/bin/sh). Only paths shorter than 99 characters are
used.
git tar-tree applies the commit date to every file in the archive it
git archive applies the commit date to every file in the archive it
creates. The test sets the commit date to a specific value and checks
if the tar archive contains that value.
When giving git tar-tree a commit id (in contrast to a tree id) it
When giving git archive a commit id (in contrast to a tree id) it
embeds this commit id into the tar archive as a comment. The test
checks the ability of git get-tar-commit-id to figure it out from the
tar file.
Expand Down Expand Up @@ -196,16 +196,6 @@ test_expect_success \
'git get-tar-commit-id <b.tar >b.commitid &&
test_cmp .git/$(git symbolic-ref HEAD) b.commitid'

test_expect_success 'git tar-tree' '
git tar-tree HEAD >tar-tree.tar &&
test_cmp b.tar tar-tree.tar
'

test_expect_success 'git tar-tree with prefix' '
git tar-tree HEAD prefix >tar-tree_with_prefix.tar &&
test_cmp with_prefix.tar tar-tree_with_prefix.tar
'

test_expect_success 'git archive with --output, override inferred format' '
git archive --format=tar --output=d4.zip HEAD &&
test_cmp b.tar d4.zip
Expand Down
10 changes: 0 additions & 10 deletions t/t5001-archive-attr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,4 @@ test_expect_success 'export-subst' '
test_cmp substfile2 archive/substfile2
'

test_expect_success 'git tar-tree vs. git archive with worktree attributes' '
git tar-tree HEAD >tar-tree.tar &&
test_cmp worktree.tar tar-tree.tar
'

test_expect_success 'git tar-tree vs. git archive with worktree attrs, bare' '
(cd bare && git tar-tree HEAD) >bare-tar-tree.tar &&
test_cmp bare-worktree.tar bare-tar-tree.tar
'

test_done

0 comments on commit 925cecc

Please sign in to comment.