svnimport: avoid open "-|" list form for Perl 5.6
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Feb 20, 2006 at 14:14 UTC
7ae0dc015dc38ce937bb2c044ff8b4875678e8af
1 file changed
+16
-4
git-svnimport.perl
+16
-4
@@ -10,7 +10,6 @@
10
# The head revision is on branch "origin" by default.
11
# You can change that with the '-o' option.
12
13
-require 5.008; # for shell-safe open("-|",LIST)
13
use strict;
14
use warnings;
15
use Getopt::Std;
@@ -322,8 +321,12 @@ sub get_file($$$) {
321
return undef unless defined $name;
322
}
323
325
- open my $F, '-|', "git-hash-object", "-w", $name
324
+ my $pid = open(my $F, '-|');
325
+ die $! unless defined $pid;
326
+ if (!$pid) {
327
+ exec("git-hash-object", "-w", $name)
328
or die "Cannot create object: $!\n";
329
+ }
330
my $sha = <$F>;
331
chomp $sha;
332
close $F;
@@ -398,7 +401,12 @@ sub copy_path($$$$$$$$) {
401
$srcpath =~ s#/*$#/#;
402
}
403
401
- open my $f,"-|","git-ls-tree","-r","-z",$gitrev,$srcpath;
404
+ my $pid = open my $f,'-|';
405
+ die $! unless defined $pid;
406
+ if (!$pid) {
407
+ exec("git-ls-tree","-r","-z",$gitrev,$srcpath)
408
+ or die $!;
409
+ }
410
local $/ = "\0";
411
while(<$f>) {
412
chomp;
@@ -554,7 +562,11 @@ sub commit {
562
@o1 = @old;
563
@old = ();
564
}
557
- open my $F, "-|", "git-ls-files", "-z", @o1 or die $!;
565
+ my $pid = open my $F, "-|";
566
+ die "$!" unless defined $pid;
567
+ if (!$pid) {
568
+ exec("git-ls-files", "-z", @o1) or die $!;
569
+ }
570
@o1 = ();
571
local $/ = "\0";
572
while(<$F>) {