Code

Merge branch 'jc/pretty-lf'
[git.git] / contrib / fast-import / import-tars.perl
index a909716682cd1ad6364c3a9509f45936f69a8134..95438e1ed42f7289131a1b08654a2b23098c8e26 100755 (executable)
@@ -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 {
@@ -140,7 +143,7 @@ foreach my $tar_file (@ARGV)
                                } elsif (!$header_done && /^Author:\s+([^<>]*)\s+<(.*)>\s*$/i) {
                                        $this_author_name = $1;
                                        $this_author_email = $2;
-                               } elsif (!$header_done && /^$/ { # empty line ends header.
+                               } elsif (!$header_done && /^$/) { # empty line ends header.
                                        $header_done = 1;
                                } else {
                                        $commit_msg .= $_;