summaryrefslogtreecommitdiff
path: root/contrib/fast-import/import-tars.perl
diff options
context:
space:
mode:
authorIngmar Vanhassel <ingmar@exherbo.org>2009-10-20 10:29:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-10-22 00:15:43 (GMT)
commit2a94552887ecbaa8b848a92eb607e032d77c8a2c (patch)
treeb66142c6dd45bdf349ef33d3f9439e900ac2abe3 /contrib/fast-import/import-tars.perl
parent78d553b7d7b269bb22ebd8b1198657c37484a3a0 (diff)
downloadgit-2a94552887ecbaa8b848a92eb607e032d77c8a2c.zip
git-2a94552887ecbaa8b848a92eb607e032d77c8a2c.tar.gz
git-2a94552887ecbaa8b848a92eb607e032d77c8a2c.tar.bz2
import-tars: Add support for tarballs compressed with lzma, xz
Also handle the extensions .tlz and .txz, aliases for .tar.lzma and .tar.xz respectively. Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org> Liked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/fast-import/import-tars.perl')
-rwxr-xr-xcontrib/fast-import/import-tars.perl5
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/fast-import/import-tars.perl b/contrib/fast-import/import-tars.perl
index 7001862..95438e1 100755
--- a/contrib/fast-import/import-tars.perl
+++ b/contrib/fast-import/import-tars.perl
@@ -20,7 +20,7 @@ use Getopt::Long;
my $metaext = '';
-die "usage: import-tars [--metainfo=extension] *.tar.{gz,bz2,Z}\n"
+die "usage: import-tars [--metainfo=extension] *.tar.{gz,bz2,lzma,xz,Z}\n"
unless GetOptions('metainfo=s' => \$metaext) && @ARGV;
my $branch_name = 'import-tars';
@@ -49,6 +49,9 @@ foreach my $tar_file (@ARGV)
} elsif ($tar_name =~ s/\.tar\.Z$//) {
open(I, '-|', 'uncompress', '-c', $tar_file)
or die "Unable to uncompress -c $tar_file: $!\n";
+ } elsif ($tar_name =~ s/\.(tar\.(lzma|xz)|(tlz|txz))$//) {
+ open(I, '-|', 'xz', '-dc', $tar_file)
+ or die "Unable to xz -dc $tar_file: $!\n";
} elsif ($tar_name =~ s/\.tar$//) {
open(I, $tar_file) or die "Unable to open $tar_file: $!\n";
} else {