From 8ff21b1a3307c7059ea1e00b5117a50a2bc5fec8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 9 Apr 2007 17:12:53 +0200 Subject: [PATCH] git-archive: make tar the default format As noted by Junio, --format=tar should be assumed if no format was specified. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- Documentation/git-archive.txt | 3 ++- builtin-archive.c | 4 +--- t/t5000-tar-tree.sh | 10 +++++++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Documentation/git-archive.txt b/Documentation/git-archive.txt index 493474b2ee..8d1041598e 100644 --- a/Documentation/git-archive.txt +++ b/Documentation/git-archive.txt @@ -30,7 +30,8 @@ OPTIONS ------- --format=:: - Format of the resulting archive: 'tar', 'zip'... + Format of the resulting archive: 'tar', 'zip'... The default + is 'tar'. --list:: Show all available formats. diff --git a/builtin-archive.c b/builtin-archive.c index 8ea6cb1efc..7f4e409c99 100644 --- a/builtin-archive.c +++ b/builtin-archive.c @@ -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); diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index b4359df795..e223c074f0 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -50,8 +50,16 @@ test_expect_success \ git-commit-tree $treeid 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' \ -- 2.11.4.GIT