summaryrefslogtreecommitdiff
path: root/archive-tar.c
diff options
context:
space:
mode:
authorJeff King <peff@github.com>2011-06-21 23:17:35 -0400
committerJunio C Hamano <gitster@pobox.com>2011-06-22 11:12:35 -0700
commit7b97730b764cac823531ccd14669f9c5b45496dc (patch)
tree87374df5dba2d033843fe9ccfcec6ccf10d14c38 /archive-tar.c
parent0e804e09938905ed4fe6984f832057267cc5d86f (diff)
downloadgit-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-tar.c')
-rw-r--r--archive-tar.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/archive-tar.c b/archive-tar.c
index f470ebea12..20af0051a3 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -274,6 +274,13 @@ static int tar_filter_config(const char *var, const char *value, void *data)
ar->data = xstrdup(value);
return 0;
}
+ if (!strcmp(type, "remote")) {
+ if (git_config_bool(var, value))
+ ar->flags |= ARCHIVER_REMOTE;
+ else
+ ar->flags &= ~ARCHIVER_REMOTE;
+ return 0;
+ }
return 0;
}
@@ -349,7 +356,7 @@ static int write_tar_filter_archive(const struct archiver *ar,
static struct archiver tar_archiver = {
"tar",
write_tar_archive,
- 0
+ ARCHIVER_REMOTE
};
void init_tar_archiver(void)
@@ -358,7 +365,9 @@ void init_tar_archiver(void)
register_archiver(&tar_archiver);
tar_filter_config("tar.tgz.command", "gzip -cn", NULL);
+ tar_filter_config("tar.tgz.remote", "true", NULL);
tar_filter_config("tar.tar.gz.command", "gzip -cn", NULL);
+ tar_filter_config("tar.tar.gz.remote", "true", NULL);
git_config(git_tar_config, NULL);
for (i = 0; i < nr_tar_filters; i++) {
/* omit any filters that never had a command configured */