aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-02-21 22:51:21 -0800
committerJunio C Hamano <junkio@cox.net>2006-02-21 22:51:21 -0800
commit6b98579babe767b343bf6e1448b52befd5fc0a2e (patch)
tree670d6a5c5667d72a148696e33b61dd81005c7640
parent155d12912fec6c60ead6d6c1febda5fa6e6eb128 (diff)
parentdd27478f092295069b148a4cfcf92fea9a4aab03 (diff)
downloadgit-6b98579babe767b343bf6e1448b52befd5fc0a2e.tar.gz
git-6b98579babe767b343bf6e1448b52befd5fc0a2e.tar.xz
Merge branch 'jc/perl'
* jc/perl: cvsimport: avoid open "-|" list form for Perl 5.6 svnimport: avoid open "-|" list form for Perl 5.6 send-email: avoid open "-|" list form for Perl 5.6 rerere: avoid open "-|" list form for Perl 5.6 fmt-merge-msg: avoid open "-|" list form for Perl 5.6
-rwxr-xr-xgit-cvsimport.perl6
-rwxr-xr-xgit-fmt-merge-msg.perl24
-rwxr-xr-xgit-rerere.perl6
-rwxr-xr-xgit-send-email.perl37
-rwxr-xr-xgit-svnimport.perl20
5 files changed, 63 insertions, 30 deletions
diff --git a/git-cvsimport.perl b/git-cvsimport.perl
index 24f983434..b46469ab3 100755
--- a/git-cvsimport.perl
+++ b/git-cvsimport.perl
@@ -846,8 +846,12 @@ while(<CVS>) {
print "Drop $fn\n" if $opt_v;
} else {
print "".($init ? "New" : "Update")." $fn: $size bytes\n" if $opt_v;
- open my $F, '-|', "git-hash-object -w $tmpname"
+ my $pid = open(my $F, '-|');
+ die $! unless defined $pid;
+ if (!$pid) {
+ exec("git-hash-object", "-w", $tmpname)
or die "Cannot create object: $!\n";
+ }
my $sha = <$F>;
chomp $sha;
close $F;
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index 3de67d779..c13af4884 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -28,11 +28,12 @@ sub andjoin {
}
sub repoconfig {
- my $fh;
my $val;
eval {
- open $fh, '-|', 'git-repo-config', '--get', 'merge.summary'
- or die "$!";
+ my $pid = open(my $fh, '-|');
+ if (!$pid) {
+ exec('git-repo-config', '--get', 'merge.summary');
+ }
($val) = <$fh>;
close $fh;
};
@@ -41,25 +42,32 @@ sub repoconfig {
sub current_branch {
my $fh;
- open $fh, '-|', 'git-symbolic-ref', 'HEAD' or die "$!";
+ my $pid = open($fh, '-|');
+ die "$!" unless defined $pid;
+ if (!$pid) {
+ exec('git-symbolic-ref', 'HEAD') or die "$!";
+ }
my ($bra) = <$fh>;
chomp($bra);
+ close $fh or die "$!";
$bra =~ s|^refs/heads/||;
if ($bra ne 'master') {
$bra = " into $bra";
} else {
$bra = "";
}
-
return $bra;
}
sub shortlog {
my ($tip) = @_;
my ($fh, @result);
- open $fh, '-|', ('git-log', '--topo-order',
- '--pretty=oneline', $tip, '^HEAD')
- or die "$!";
+ my $pid = open($fh, '-|');
+ die "$!" unless defined $pid;
+ if (!$pid) {
+ exec('git-log', '--topo-order',
+ '--pretty=oneline', $tip, '^HEAD') or die "$!";
+ }
while (<$fh>) {
s/^[0-9a-f]{40}\s+//;
push @result, $_;
diff --git a/git-rerere.perl b/git-rerere.perl
index df119517f..d3664ff49 100755
--- a/git-rerere.perl
+++ b/git-rerere.perl
@@ -131,7 +131,11 @@ sub record_preimage {
sub find_conflict {
my $in;
local $/ = "\0";
- open $in, '-|', qw(git ls-files -z -u) or die "$!: ls-files";
+ my $pid = open($in, '-|');
+ die "$!" unless defined $pid;
+ if (!$pid) {
+ exec(qw(git ls-files -z -u)) or die "$!: ls-files";
+ }
my %path = ();
my @path = ();
while (<$in>) {
diff --git a/git-send-email.perl b/git-send-email.perl
index 13b85dddd..b0d095b4e 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -59,24 +59,29 @@ my $rc = GetOptions("from=s" => \$from,
# Now, let's fill any that aren't set in with defaults:
-open(GITVAR,"-|","git-var","-l")
- or die "Failed to open pipe from git-var: $!";
-
-my ($author,$committer);
-while(<GITVAR>) {
- chomp;
- my ($var,$data) = split /=/,$_,2;
- my @fields = split /\s+/, $data;
-
- my $ident = join(" ", @fields[0...(@fields-3)]);
+sub gitvar {
+ my ($var) = @_;
+ my $fh;
+ my $pid = open($fh, '-|');
+ die "$!" unless defined $pid;
+ if (!$pid) {
+ exec('git-var', $var) or die "$!";
+ }
+ my ($val) = <$fh>;
+ close $fh or die "$!";
+ chomp($val);
+ return $val;
+}
- if ($var eq 'GIT_AUTHOR_IDENT') {
- $author = $ident;
- } elsif ($var eq 'GIT_COMMITTER_IDENT') {
- $committer = $ident;
- }
+sub gitvar_ident {
+ my ($name) = @_;
+ my $val = gitvar($name);
+ my @field = split(/\s+/, $val);
+ return join(' ', @field[0...(@field-3)]);
}
-close(GITVAR);
+
+my ($author) = gitvar_ident('GIT_AUTHOR_IDENT');
+my ($committer) = gitvar_ident('GIT_COMMITTER_IDENT');
my $prompting = 0;
if (!defined $from) {
diff --git a/git-svnimport.perl b/git-svnimport.perl
index c536d7026..ee2940f48 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;
@@ -322,8 +321,12 @@ sub get_file($$$) {
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;
@@ -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>) {