diff options
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-x | git-send-email.perl | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/git-send-email.perl b/git-send-email.perl index c6bba47eb6..0b04ba32f0 100755 --- a/git-send-email.perl +++ b/git-send-email.perl @@ -168,7 +168,8 @@ my $envelope_sender; # Example reply to: #$initial_reply_to = ''; #<20050203173208.GA23964@foobar.com>'; -my $repo = Git->repository(); +my $repo = eval { Git->repository() }; +my @repo = $repo ? ($repo) : (); my $term = eval { $ENV{"GIT_SEND_EMAIL_NOTTY"} ? new Term::ReadLine 'git-send-email', \*STDIN, \*STDOUT @@ -202,11 +203,13 @@ my %config_settings = ( "smtpuser" => \$smtp_authuser, "smtppass" => \$smtp_authpass, "to" => \@to, + "cc" => \@initial_cc, "cccmd" => \$cc_cmd, "aliasfiletype" => \$aliasfiletype, "bcc" => \@bcclist, "aliasesfile" => \@alias_files, "suppresscc" => \@suppress_cc, + "envelopesender" => \$envelope_sender, ); # Handle Uncouth Termination @@ -271,25 +274,25 @@ sub read_config { foreach my $setting (keys %config_bool_settings) { my $target = $config_bool_settings{$setting}->[0]; - $$target = $repo->config_bool("$prefix.$setting") unless (defined $$target); + $$target = Git::config_bool(@repo, "$prefix.$setting") unless (defined $$target); } foreach my $setting (keys %config_settings) { my $target = $config_settings{$setting}; if (ref($target) eq "ARRAY") { unless (@$target) { - my @values = $repo->config("$prefix.$setting"); + my @values = Git::config(@repo, "$prefix.$setting"); @$target = @values if (@values && defined $values[0]); } } else { - $$target = $repo->config("$prefix.$setting") unless (defined $$target); + $$target = Git::config(@repo, "$prefix.$setting") unless (defined $$target); } } } # read configuration from [sendemail "$identity"], fall back on [sendemail] -$identity = $repo->config("sendemail.identity") unless (defined $identity); +$identity = Git::config(@repo, "sendemail.identity") unless (defined $identity); read_config("sendemail.$identity") if (defined $identity); read_config("sendemail"); @@ -327,8 +330,9 @@ if (0) { } } -my ($repoauthor) = $repo->ident_person('author'); -my ($repocommitter) = $repo->ident_person('committer'); +my ($repoauthor, $repocommitter); +($repoauthor) = Git::ident_person(@repo, 'author'); +($repocommitter) = Git::ident_person(@repo, 'committer'); # Verify the user input @@ -415,7 +419,7 @@ if (@files) { my $prompting = 0; if (!defined $sender) { - $sender = $repoauthor || $repocommitter; + $sender = $repoauthor || $repocommitter || ''; while (1) { $_ = $term->readline("Who should the emails appear to be from? [$sender] "); @@ -438,7 +442,7 @@ if (!@to) { } my $to = $_; - push @to, split /,/, $to; + push @to, split /,\s*/, $to; $prompting++; } @@ -509,8 +513,8 @@ GIT: for the patch you are writing. EOT close(C); - my $editor = $ENV{GIT_EDITOR} || $repo->config("core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi"; - system('sh', '-c', '$0 $@', $editor, $compose_filename); + my $editor = $ENV{GIT_EDITOR} || Git::config(@repo, "core.editor") || $ENV{VISUAL} || $ENV{EDITOR} || "vi"; + system('sh', '-c', $editor.' "$@"', $editor, $compose_filename); open(C2,">",$compose_filename . ".final") or die "Failed to open $compose_filename.final : " . $!; |