diff options
author | Junio C Hamano <junkio@cox.net> | 2006-02-20 14:02:25 -0800 |
---|---|---|
committer | Junio C Hamano <junkio@cox.net> | 2006-02-20 14:21:10 -0800 |
commit | 2a86ec46da99e4cd5e6e394d378ba119d8f5069d (patch) | |
tree | fa6c61b9ed820d83879c1bbe0b681767491c8086 /git-fmt-merge-msg.perl | |
parent | 551ce28fe1f2777eee7dd9c02bd44f55f4b32361 (diff) | |
download | git-2a86ec46da99e4cd5e6e394d378ba119d8f5069d.tar.gz |
fmt-merge-msg: avoid open "-|" list form for Perl 5.6
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'git-fmt-merge-msg.perl')
-rwxr-xr-x | git-fmt-merge-msg.perl | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl index c34ddc5d5e..a77e94eb5a 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, $limit) = @_; my ($fh, @result); - open $fh, '-|', ('git-log', "--max-count=$limit", '--topo-order', - '--pretty=oneline', $tip, '^HEAD') - or die "$!"; + my $pid = open($fh, '-|'); + die "$!" unless defined $pid; + if (!$pid) { + exec('git-log', "--max-count=$limit", '--topo-order', + '--pretty=oneline', $tip, '^HEAD') or die "$!"; + } while (<$fh>) { s/^[0-9a-f]{40}\s+//; push @result, $_; |