From: "Alex Riesen" <raa.lkml@gmail.com>
To: "Git Mailing List" <git@vger.kernel.org>
Cc: "Junio C Hamano" <junkio@cox.net>
Subject: PATCH: simplify calls to git programs in git-fmt-merge-msg
Date: Thu, 23 Feb 2006 11:26:46 +0100 [thread overview]
Message-ID: <81b0412b0602230226j12e88682h303d466a273bec09@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 44 bytes --]
It also makes it work on ActiveState Perl.
[-- Attachment #2: 0001-fix-git-fmt-merge-msg.perl-for-activestate-perl.txt --]
[-- Type: text/plain, Size: 1470 bytes --]
---
git-fmt-merge-msg.perl | 31 +++++--------------------------
1 files changed, 5 insertions(+), 26 deletions(-)
1c0dd861fa32017cf7bc4226bfa54d390a3fb91e
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;
}
--
1.2.3.g6ae0e
next reply other threads:[~2006-02-23 10:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-23 10:26 Alex Riesen [this message]
2006-02-23 10:35 ` PATCH: simplify calls to git programs in git-fmt-merge-msg Junio C Hamano
2006-02-23 10:57 ` Alex Riesen
2006-02-23 12:36 ` Johannes Schindelin
2006-02-23 12:40 ` Alex Riesen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81b0412b0602230226j12e88682h303d466a273bec09@mail.gmail.com \
--to=raa.lkml@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).