]> asedeno.scripts.mit.edu Git - git.git/blobdiff - contrib/fast-import/import-tars.perl
Use gunzip -c over gzcat in import-tars example.
[git.git] / contrib / fast-import / import-tars.perl
index 26c42c978080c19316e0c4086c07ab2ab47cc7aa..5585a8b2c575f92e6154e03641b467e5e54509f4 100755 (executable)
@@ -25,11 +25,14 @@ foreach my $tar_file (@ARGV)
        my $tar_name = $1;
 
        if ($tar_name =~ s/\.(tar\.gz|tgz)$//) {
-               open(I, '-|', 'gzcat', $tar_file) or die "Unable to gzcat $tar_file: $!\n";
+               open(I, '-|', 'gunzip', '-c', $tar_file)
+                       or die "Unable to gunzip -c $tar_file: $!\n";
        } elsif ($tar_name =~ s/\.(tar\.bz2|tbz2)$//) {
-               open(I, '-|', 'bzcat', $tar_file) or die "Unable to bzcat $tar_file: $!\n";
+               open(I, '-|', 'bunzip2', '-c', $tar_file)
+                       or die "Unable to bunzip2 -c $tar_file: $!\n";
        } elsif ($tar_name =~ s/\.tar\.Z$//) {
-               open(I, '-|', 'zcat', $tar_file) or die "Unable to zcat $tar_file: $!\n";
+               open(I, '-|', 'uncompress', '-c', $tar_file)
+                       or die "Unable to uncompress -c $tar_file: $!\n";
        } elsif ($tar_name =~ s/\.tar$//) {
                open(I, $tar_file) or die "Unable to open $tar_file: $!\n";
        } else {
@@ -83,10 +86,8 @@ EOF
        foreach my $path (keys %files)
        {
                my ($mark, $mode) = @{$files{$path}};
-               my $git_mode = 0644;
-               $git_mode |= 0700 if $mode & 0111;
                $path =~ s,^([^/]+)/,, if $have_top_dir;
-               printf FI "M %o :%i %s\n", $git_mode, $mark, $path;
+               printf FI "M %o :%i %s\n", $mode & 0111 ? 0755 : 0644, $mark, $path;
        }
        print FI "\n";