mirror of
https://github.com/git/git.git
synced 2025-03-31 13:21:09 +00:00
PATCH: simplify calls to git programs in git-fmt-merge-msg
It also makes it work on ActiveState Perl. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
98214e96be
commit
a92c73eccc
@ -28,28 +28,13 @@ sub andjoin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub repoconfig {
|
sub repoconfig {
|
||||||
my $val;
|
my ($val) = qx{git-repo-config --get merge.summary};
|
||||||
eval {
|
|
||||||
my $pid = open(my $fh, '-|');
|
|
||||||
if (!$pid) {
|
|
||||||
exec('git-repo-config', '--get', 'merge.summary');
|
|
||||||
}
|
|
||||||
($val) = <$fh>;
|
|
||||||
close $fh;
|
|
||||||
};
|
|
||||||
return $val;
|
return $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub current_branch {
|
sub current_branch {
|
||||||
my $fh;
|
my ($bra) = qx{git-symbolic-ref HEAD};
|
||||||
my $pid = open($fh, '-|');
|
|
||||||
die "$!" unless defined $pid;
|
|
||||||
if (!$pid) {
|
|
||||||
exec('git-symbolic-ref', 'HEAD') or die "$!";
|
|
||||||
}
|
|
||||||
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";
|
||||||
@ -61,18 +46,12 @@ sub current_branch {
|
|||||||
|
|
||||||
sub shortlog {
|
sub shortlog {
|
||||||
my ($tip) = @_;
|
my ($tip) = @_;
|
||||||
my ($fh, @result);
|
my @result;
|
||||||
my $pid = open($fh, '-|');
|
foreach ( qx{git-log --topo-order --pretty=oneline $tip ^HEAD} ) {
|
||||||
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+//;
|
s/^[0-9a-f]{40}\s+//;
|
||||||
push @result, $_;
|
push @result, $_;
|
||||||
}
|
}
|
||||||
close $fh or die "$!";
|
die "git-log failed\n" if $?;
|
||||||
return @result;
|
return @result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user