Skip to content

Commit

Permalink
fmt-merge-msg: 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 551ce28 commit 2a86ec4
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions git-fmt-merge-msg.perl
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand All @@ -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, $_;
Expand Down

0 comments on commit 2a86ec4

Please sign in to comment.