summaryrefslogtreecommitdiff
path: root/git-fmt-merge-msg.perl
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2006-02-23 10:26:46 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-02-23 11:49:09 (GMT)
commita92c73eccc81b5bfc9e62866505ff1ea72492173 (patch)
treed6ad4004832e9fc3b5f781b4ef4eee0475e73ade /git-fmt-merge-msg.perl
parent98214e96be00c5132047ae80bca20d4690933c33 (diff)
downloadgit-a92c73eccc81b5bfc9e62866505ff1ea72492173.zip
git-a92c73eccc81b5bfc9e62866505ff1ea72492173.tar.gz
git-a92c73eccc81b5bfc9e62866505ff1ea72492173.tar.bz2
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>
Diffstat (limited to 'git-fmt-merge-msg.perl')
-rwxr-xr-xgit-fmt-merge-msg.perl31
1 files changed, 5 insertions, 26 deletions
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl
index c13af48..dae383f 100755
--- a/git-fmt-merge-msg.perl
+++ b/git-fmt-merge-msg.perl
@@ -28,28 +28,13 @@ sub andjoin {
}
sub repoconfig {
- my $val;
- eval {
- my $pid = open(my $fh, '-|');
- if (!$pid) {
- exec('git-repo-config', '--get', 'merge.summary');
- }
- ($val) = <$fh>;
- close $fh;
- };
+ my ($val) = qx{git-repo-config --get merge.summary};
return $val;
}
sub current_branch {
- my $fh;
- my $pid = open($fh, '-|');
- die "$!" unless defined $pid;
- if (!$pid) {
- exec('git-symbolic-ref', 'HEAD') or die "$!";
- }
- my ($bra) = <$fh>;
+ my ($bra) = qx{git-symbolic-ref HEAD};
chomp($bra);
- close $fh or die "$!";
$bra =~ s|^refs/heads/||;
if ($bra ne 'master') {
$bra = " into $bra";
@@ -61,18 +46,12 @@ sub current_branch {
sub shortlog {
my ($tip) = @_;
- my ($fh, @result);
- my $pid = open($fh, '-|');
- die "$!" unless defined $pid;
- if (!$pid) {
- exec('git-log', '--topo-order',
- '--pretty=oneline', $tip, '^HEAD') or die "$!";
- }
- while (<$fh>) {
+ my @result;
+ foreach ( qx{git-log --topo-order --pretty=oneline $tip ^HEAD} ) {
s/^[0-9a-f]{40}\s+//;
push @result, $_;
}
- close $fh or die "$!";
+ die "git-log failed\n" if $?;
return @result;
}