X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=git-svnimport.perl;h=ee2940f4803955f2746baf3c78f64a67b4790cab;hb=882e4dc18347de18f0ab89ea055dda281c295092;hp=f17d5a27c82a31b82f066540ed40c83fc66cf91b;hpb=7bbdeaa969794edd67cd4a1ed09b9a057b6af4c3;p=git.git diff --git a/git-svnimport.perl b/git-svnimport.perl index f17d5a27..ee2940f4 100755 --- a/git-svnimport.perl +++ b/git-svnimport.perl @@ -10,7 +10,6 @@ # The head revision is on branch "origin" by default. # You can change that with the '-o' option. -require 5.008; # for shell-safe open("-|",LIST) use strict; use warnings; use Getopt::Std; @@ -30,19 +29,19 @@ die "Need SVN:Core 1.2.1 or better" if $SVN::Core::VERSION lt "1.2.1"; $SIG{'PIPE'}="IGNORE"; $ENV{'TZ'}="UTC"; -our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b,$opt_s,$opt_l,$opt_d,$opt_D); +our($opt_h,$opt_o,$opt_v,$opt_u,$opt_C,$opt_i,$opt_m,$opt_M,$opt_t,$opt_T,$opt_b,$opt_r,$opt_s,$opt_l,$opt_d,$opt_D); sub usage() { print STDERR <; chomp $sha; close $F; @@ -398,7 +401,12 @@ sub copy_path($$$$$$$$) { $srcpath =~ s#/*$#/#; } - open my $f,"-|","git-ls-tree","-r","-z",$gitrev,$srcpath; + my $pid = open my $f,'-|'; + die $! unless defined $pid; + if (!$pid) { + exec("git-ls-tree","-r","-z",$gitrev,$srcpath) + or die $!; + } local $/ = "\0"; while(<$f>) { chomp; @@ -554,7 +562,11 @@ sub commit { @o1 = @old; @old = (); } - open my $F, "-|", "git-ls-files", "-z", @o1 or die $!; + my $pid = open my $F, "-|"; + die "$!" unless defined $pid; + if (!$pid) { + exec("git-ls-files", "-z", @o1) or die $!; + } @o1 = (); local $/ = "\0"; while(<$F>) { @@ -650,6 +662,7 @@ sub commit { $pr->reader(); $message =~ s/[\s\n]+\z//; + $message = "r$revision: $message" if $opt_r; print $pw "$message\n" or die "Error writing to git-commit-tree: $!\n";