diff options
author | Jeff King <peff@github.com> | 2011-06-21 23:17:35 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-06-22 11:12:35 -0700 |
commit | 7b97730b764cac823531ccd14669f9c5b45496dc (patch) | |
tree | 87374df5dba2d033843fe9ccfcec6ccf10d14c38 /archive.c | |
parent | 0e804e09938905ed4fe6984f832057267cc5d86f (diff) | |
download | git-7b97730b764cac823531ccd14669f9c5b45496dc.tar.gz |
upload-archive: allow user to turn off filters
Some tar filters may be very expensive to run, so sites do
not want to expose them via upload-archive. This patch lets
users configure tar.<filter>.remote to turn them off.
By default, gzip filters are left on, as they are about as
expensive as creating zip archives.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive.c')
-rw-r--r-- | archive.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -299,7 +299,7 @@ static void parse_treeish_arg(const char **argv, static int parse_archive_args(int argc, const char **argv, const struct archiver **ar, struct archiver_args *args, - const char *name_hint) + const char *name_hint, int is_remote) { const char *format = NULL; const char *base = NULL; @@ -356,7 +356,8 @@ static int parse_archive_args(int argc, const char **argv, if (list) { for (i = 0; i < nr_archivers; i++) - printf("%s\n", archivers[i]->name); + if (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE) + printf("%s\n", archivers[i]->name); exit(0); } @@ -369,7 +370,7 @@ static int parse_archive_args(int argc, const char **argv, if (argc < 1) usage_with_options(archive_usage, opts); *ar = lookup_archiver(format); - if (!*ar) + if (!*ar || (is_remote && !((*ar)->flags & ARCHIVER_REMOTE))) die("Unknown archive format '%s'", format); args->compression_level = Z_DEFAULT_COMPRESSION; @@ -390,7 +391,7 @@ static int parse_archive_args(int argc, const char **argv, } int write_archive(int argc, const char **argv, const char *prefix, - int setup_prefix, const char *name_hint) + int setup_prefix, const char *name_hint, int remote) { int nongit = 0; const struct archiver *ar = NULL; @@ -403,7 +404,7 @@ int write_archive(int argc, const char **argv, const char *prefix, init_tar_archiver(); init_zip_archiver(); - argc = parse_archive_args(argc, argv, &ar, &args, name_hint); + argc = parse_archive_args(argc, argv, &ar, &args, name_hint, remote); if (nongit) { /* * We know this will die() with an error, so we could just |