Skip to content

Commit

Permalink
git-archive: make tar the default format
Browse files Browse the repository at this point in the history
As noted by Junio, --format=tar should be assumed if no format
was specified.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
René Scharfe authored and Junio C Hamano committed Apr 10, 2007
1 parent 5bcbc7f commit 8ff21b1
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Documentation/git-archive.txt
Original file line number Diff line number Diff line change
@@ -30,7 +30,8 @@ OPTIONS
-------

--format=<fmt>::
Format of the resulting archive: 'tar', 'zip'...
Format of the resulting archive: 'tar', 'zip'... The default
is 'tar'.

--list::
Show all available formats.
4 changes: 1 addition & 3 deletions builtin-archive.c
Original file line number Diff line number Diff line change
@@ -149,7 +149,7 @@ int parse_archive_args(int argc, const char **argv, struct archiver *ar)
{
const char *extra_argv[MAX_EXTRA_ARGS];
int extra_argc = 0;
const char *format = NULL; /* might want to default to "tar" */
const char *format = "tar";
const char *base = "";
int verbose = 0;
int i;
@@ -190,8 +190,6 @@ int parse_archive_args(int argc, const char **argv, struct archiver *ar)
/* We need at least one parameter -- tree-ish */
if (argc - 1 < i)
usage(archive_usage);
if (!format)
die("You must specify an archive format");
if (init_archiver(format, ar) < 0)
die("Unknown archive format '%s'", format);

10 changes: 9 additions & 1 deletion t/t5000-tar-tree.sh
Original file line number Diff line number Diff line change
@@ -49,9 +49,17 @@ test_expect_success \
git-update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
git-commit-tree $treeid </dev/null)'

test_expect_success \
'git-archive' \
'git-archive HEAD >b.tar'

test_expect_success \
'git-tar-tree' \
'git-tar-tree HEAD >b.tar'
'git-tar-tree HEAD >b2.tar'

test_expect_success \
'git-archive vs. git-tar-tree' \
'diff b.tar b2.tar'

test_expect_success \
'validate file modification time' \

0 comments on commit 8ff21b1

Please sign in to comment.