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 <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
René Scharfe committed
Apr 9, 2007 at 17:12 UTC
8ff21b1a3307c7059ea1e00b5117a50a2bc5fec8
3 files changed
+12
-5
Documentation/git-archive.txt
+2
-1
@@ -30,7 +30,8 @@ OPTIONS
30
-------
31
32
--format=<fmt>::
33
- Format of the resulting archive: 'tar', 'zip'...
33
+ Format of the resulting archive: 'tar', 'zip'... The default
34
+ is 'tar'.
35
36
--list::
37
Show all available formats.
builtin-archive.c
+1
-3
@@ -149,7 +149,7 @@ int parse_archive_args(int argc, const char **argv, struct archiver *ar)
149
{
150
const char *extra_argv[MAX_EXTRA_ARGS];
151
int extra_argc = 0;
152
- const char *format = NULL; /* might want to default to "tar" */
152
+ const char *format = "tar";
153
const char *base = "";
154
int verbose = 0;
155
int i;
@@ -190,8 +190,6 @@ int parse_archive_args(int argc, const char **argv, struct archiver *ar)
190
/* We need at least one parameter -- tree-ish */
191
if (argc - 1 < i)
192
usage(archive_usage);
193
- if (!format)
194
- die("You must specify an archive format");
193
if (init_archiver(format, ar) < 0)
194
die("Unknown archive format '%s'", format);
195
t/t5000-tar-tree.sh
+9
-1
@@ -49,9 +49,17 @@ test_expect_success \
49
git-update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
50
git-commit-tree $treeid </dev/null)'
51
52
+test_expect_success \
53
+ 'git-archive' \
54
+ 'git-archive HEAD >b.tar'
55
+
56
test_expect_success \
57
'git-tar-tree' \
54
- 'git-tar-tree HEAD >b.tar'
58
+ 'git-tar-tree HEAD >b2.tar'
59
+
60
+test_expect_success \
61
+ 'git-archive vs. git-tar-tree' \
62
+ 'diff b.tar b2.tar'
63
64
test_expect_success \
65
'validate file modification time' \