summaryrefslogtreecommitdiff
path: root/t/t5000-tar-tree.sh
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 /t/t5000-tar-tree.sh
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 't/t5000-tar-tree.sh')
-rwxr-xr-xt/t5000-tar-tree.sh25
1 files changed, 22 insertions, 3 deletions
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 070250ebb0..9e3ba98fc8 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -256,7 +256,8 @@ test_expect_success 'git-archive --prefix=olde-' '
test_expect_success 'setup tar filters' '
git config tar.tar.foo.command "tr ab ba" &&
- git config tar.bar.command "tr ab ba"
+ git config tar.bar.command "tr ab ba" &&
+ git config tar.bar.remote true
'
test_expect_success 'archive --list mentions user filter' '
@@ -265,9 +266,9 @@ test_expect_success 'archive --list mentions user filter' '
grep "^bar\$" output
'
-test_expect_success 'archive --list shows remote user filters' '
+test_expect_success 'archive --list shows only enabled remote filters' '
git archive --list --remote=. >output &&
- grep "^tar\.foo\$" output &&
+ ! grep "^tar\.foo\$" output &&
grep "^bar\$" output
'
@@ -297,6 +298,13 @@ test_expect_success 'extension matching requires dot' '
test_cmp b.tar config-implicittar.foo
'
+test_expect_success 'only enabled filters are available remotely' '
+ test_must_fail git archive --remote=. --format=tar.foo HEAD \
+ >remote.tar.foo &&
+ git archive --remote=. --format=bar >remote.bar HEAD &&
+ test_cmp remote.bar config.bar
+'
+
if $GZIP --version >/dev/null 2>&1; then
test_set_prereq GZIP
else
@@ -333,4 +341,15 @@ test_expect_success GZIP,GUNZIP 'extract tgz file' '
test_cmp b.tar j.tar
'
+test_expect_success GZIP 'remote tar.gz is allowed by default' '
+ git archive --remote=. --format=tar.gz HEAD >remote.tar.gz &&
+ test_cmp j.tgz remote.tar.gz
+'
+
+test_expect_success GZIP 'remote tar.gz can be disabled' '
+ git config tar.tar.gz.remote false &&
+ test_must_fail git archive --remote=. --format=tar.gz HEAD \
+ >remote.tar.gz
+'
+
test_done