Skip to content

Commit

Permalink
import-tars: Add support for tarballs compressed with lzma, xz
Browse files Browse the repository at this point in the history
Also handle the extensions .tlz and .txz, aliases for .tar.lzma and
.tar.xz respectively.

Signed-off-by: Ingmar Vanhassel <[email protected]>
Liked-by: Johannes Schindelin <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
  • Loading branch information
ingmarv authored and gitster committed Oct 22, 2009
1 parent 78d553b commit 2a94552
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contrib/fast-import/import-tars.perl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

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';
Expand Down Expand Up @@ -49,6 +49,9 @@
} 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 {
Expand Down

0 comments on commit 2a94552

Please sign in to comment.