diff options
author | Jeff King <peff@peff.net> | 2011-06-21 21:26:31 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2011-06-22 11:12:35 -0700 |
commit | 767cf4579f0e34a3cfc6704d5c313842321dfafa (patch) | |
tree | 737f83a9a1173e3e74c94914b78d07a801e9f8c6 /t/t5000-tar-tree.sh | |
parent | 08716b3c11f4899c1be046eca735761b30ca686d (diff) | |
download | git-767cf4579f0e34a3cfc6704d5c313842321dfafa.tar.gz |
archive: implement configurable tar filters
It's common to pipe the tar output produce by "git archive"
through gzip or some other compressor. Locally, this can
easily be done by using a shell pipe. When requesting a
remote archive, though, it cannot be done through the
upload-archive interface.
This patch allows configurable tar filters, so that one
could define a "tar.gz" format that automatically pipes tar
output through gzip.
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-x | t/t5000-tar-tree.sh | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index cff1b3e050..1f9069213a 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -252,4 +252,47 @@ test_expect_success 'git-archive --prefix=olde-' ' test -f h/olde-a/bin/sh ' +test_expect_success 'setup tar filters' ' + git config tar.tar.foo.command "tr ab ba" && + git config tar.bar.command "tr ab ba" +' + +test_expect_success 'archive --list mentions user filter' ' + git archive --list >output && + grep "^tar\.foo\$" output && + grep "^bar\$" output +' + +test_expect_success 'archive --list shows remote user filters' ' + git archive --list --remote=. >output && + grep "^tar\.foo\$" output && + grep "^bar\$" output +' + +test_expect_success 'invoke tar filter by format' ' + git archive --format=tar.foo HEAD >config.tar.foo && + tr ab ba <config.tar.foo >config.tar && + test_cmp b.tar config.tar && + git archive --format=bar HEAD >config.bar && + tr ab ba <config.bar >config.tar && + test_cmp b.tar config.tar +' + +test_expect_success 'invoke tar filter by extension' ' + git archive -o config-implicit.tar.foo HEAD && + test_cmp config.tar.foo config-implicit.tar.foo && + git archive -o config-implicit.bar HEAD && + test_cmp config.tar.foo config-implicit.bar +' + +test_expect_success 'default output format remains tar' ' + git archive -o config-implicit.baz HEAD && + test_cmp b.tar config-implicit.baz +' + +test_expect_success 'extension matching requires dot' ' + git archive -o config-implicittar.foo HEAD && + test_cmp b.tar config-implicittar.foo +' + test_done |