fmt-merge-msg: avoid open "-|" list form for Perl 5.6
Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
551ce28fe1
commit
2a86ec46da
@ -28,11 +28,12 @@ sub andjoin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub repoconfig {
|
sub repoconfig {
|
||||||
my $fh;
|
|
||||||
my $val;
|
my $val;
|
||||||
eval {
|
eval {
|
||||||
open $fh, '-|', 'git-repo-config', '--get', 'merge.summary'
|
my $pid = open(my $fh, '-|');
|
||||||
or die "$!";
|
if (!$pid) {
|
||||||
|
exec('git-repo-config', '--get', 'merge.summary');
|
||||||
|
}
|
||||||
($val) = <$fh>;
|
($val) = <$fh>;
|
||||||
close $fh;
|
close $fh;
|
||||||
};
|
};
|
||||||
@ -41,25 +42,32 @@ sub repoconfig {
|
|||||||
|
|
||||||
sub current_branch {
|
sub current_branch {
|
||||||
my $fh;
|
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>;
|
my ($bra) = <$fh>;
|
||||||
chomp($bra);
|
chomp($bra);
|
||||||
|
close $fh or die "$!";
|
||||||
$bra =~ s|^refs/heads/||;
|
$bra =~ s|^refs/heads/||;
|
||||||
if ($bra ne 'master') {
|
if ($bra ne 'master') {
|
||||||
$bra = " into $bra";
|
$bra = " into $bra";
|
||||||
} else {
|
} else {
|
||||||
$bra = "";
|
$bra = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $bra;
|
return $bra;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub shortlog {
|
sub shortlog {
|
||||||
my ($tip, $limit) = @_;
|
my ($tip, $limit) = @_;
|
||||||
my ($fh, @result);
|
my ($fh, @result);
|
||||||
open $fh, '-|', ('git-log', "--max-count=$limit", '--topo-order',
|
my $pid = open($fh, '-|');
|
||||||
'--pretty=oneline', $tip, '^HEAD')
|
die "$!" unless defined $pid;
|
||||||
or die "$!";
|
if (!$pid) {
|
||||||
|
exec('git-log', "--max-count=$limit", '--topo-order',
|
||||||
|
'--pretty=oneline', $tip, '^HEAD') or die "$!";
|
||||||
|
}
|
||||||
while (<$fh>) {
|
while (<$fh>) {
|
||||||
s/^[0-9a-f]{40}\s+//;
|
s/^[0-9a-f]{40}\s+//;
|
||||||
push @result, $_;
|
push @result, $_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user