Skip to content

Commit

Permalink
svnimport: avoid open "-|" list form for Perl 5.6
Browse files Browse the repository at this point in the history
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Feb 20, 2006
1 parent e415907 commit 7ae0dc0
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions git-svnimport.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -322,8 +321,12 @@ ($$$)
return undef unless defined $name;
}

open my $F, '-|', "git-hash-object", "-w", $name
my $pid = open(my $F, '-|');
die $! unless defined $pid;
if (!$pid) {
exec("git-hash-object", "-w", $name)
or die "Cannot create object: $!\n";
}
my $sha = <$F>;
chomp $sha;
close $F;
Expand Down Expand Up @@ -398,7 +401,12 @@ ($$$$$$$$)
$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;
Expand Down Expand Up @@ -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>) {
Expand Down

0 comments on commit 7ae0dc0

Please sign in to comment.