diff options
Diffstat (limited to 'git-fmt-merge-msg.perl')
-rwxr-xr-x | git-fmt-merge-msg.perl | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/git-fmt-merge-msg.perl b/git-fmt-merge-msg.perl index c34ddc5d5e..dae383f231 100755 --- a/git-fmt-merge-msg.perl +++ b/git-fmt-merge-msg.perl @@ -28,21 +28,12 @@ sub andjoin { } sub repoconfig { - my $fh; - my $val; - eval { - open $fh, '-|', 'git-repo-config', '--get', 'merge.summary' - or die "$!"; - ($val) = <$fh>; - close $fh; - }; + my ($val) = qx{git-repo-config --get merge.summary}; return $val; } sub current_branch { - my $fh; - open $fh, '-|', 'git-symbolic-ref', 'HEAD' or die "$!"; - my ($bra) = <$fh>; + my ($bra) = qx{git-symbolic-ref HEAD}; chomp($bra); $bra =~ s|^refs/heads/||; if ($bra ne 'master') { @@ -50,21 +41,17 @@ sub current_branch { } 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 "$!"; - while (<$fh>) { + my ($tip) = @_; + 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; } @@ -160,7 +147,7 @@ my $limit = 20; for (@origin) { my ($sha1, $name) = @$_; - my @log = shortlog($sha1, $limit + 1); + my @log = shortlog($sha1); if ($limit + 1 <= @log) { print "\n* $name: (" . scalar(@log) . " commits)\n"; } |