@matheusbsbs / matheus-bagliano / commits / 2a94552887
Fork 0

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>

Ingmar Vanhassel committed Oct 20, 2009 at 12:29 UTC 2a94552887ecbaa8b848a92eb607e032d77c8a2c
1 file changed +4 -1
contrib/fast-import/import-tars.perl
+4 -1
@@ -20,7 +20,7 @@ use Getopt::Long;
20
21 my $metaext = '';
22
23 -die "usage: import-tars [--metainfo=extension] *.tar.{gz,bz2,Z}\n"
23 +die "usage: import-tars [--metainfo=extension] *.tar.{gz,bz2,lzma,xz,Z}\n"
24 unless GetOptions('metainfo=s' => \$metaext) && @ARGV;
25
26 my $branch_name = 'import-tars';
@@ -49,6 +49,9 @@ foreach my $tar_file (@ARGV)
49 } elsif ($tar_name =~ s/\.tar\.Z$//) {
50 open(I, '-|', 'uncompress', '-c', $tar_file)
51 or die "Unable to uncompress -c $tar_file: $!\n";
52 + } elsif ($tar_name =~ s/\.(tar\.(lzma|xz)|(tlz|txz))$//) {
53 + open(I, '-|', 'xz', '-dc', $tar_file)
54 + or die "Unable to xz -dc $tar_file: $!\n";
55 } elsif ($tar_name =~ s/\.tar$//) {
56 open(I, $tar_file) or die "Unable to open $tar_file: $!\n";
57 } else {