Browse Source

send-email: avoid open "-|" list form for Perl 5.6

Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Junio C Hamano 19 years ago
parent
commit
e415907d6c
  1. 37
      git-send-email.perl

37
git-send-email.perl

@ -59,24 +59,29 @@ my $rc = GetOptions("from=s" => \$from,


# Now, let's fill any that aren't set in with defaults: # Now, let's fill any that aren't set in with defaults:


open(GITVAR,"-|","git-var","-l") sub gitvar {
or die "Failed to open pipe from git-var: $!"; my ($var) = @_;

my $fh;
my ($author,$committer); my $pid = open($fh, '-|');
while(<GITVAR>) { die "$!" unless defined $pid;
chomp; if (!$pid) {
my ($var,$data) = split /=/,$_,2; exec('git-var', $var) or die "$!";
my @fields = split /\s+/, $data; }

my ($val) = <$fh>;
my $ident = join(" ", @fields[0...(@fields-3)]); close $fh or die "$!";
chomp($val);
return $val;
}


if ($var eq 'GIT_AUTHOR_IDENT') { sub gitvar_ident {
$author = $ident; my ($name) = @_;
} elsif ($var eq 'GIT_COMMITTER_IDENT') { my $val = gitvar($name);
$committer = $ident; my @field = split(/\s+/, $val);
} return join(' ', @field[0...(@field-3)]);
} }
close(GITVAR);
my ($author) = gitvar_ident('GIT_AUTHOR_IDENT');
my ($committer) = gitvar_ident('GIT_COMMITTER_IDENT');


my $prompting = 0; my $prompting = 0;
if (!defined $from) { if (!defined $from) {

Loading…
Cancel
Save