Skip to content

Commit

Permalink
Authenticate only once in git-send-email
Browse files Browse the repository at this point in the history
When using git-send-email with SMTP authentication sending a patch series
would redundantly authenticate multiple times, once for each patch. In
the worst case, this would actually prevent the series from being sent
because the server would reply with a "5.5.0 Already Authenticated"
status code which would derail the process.

This commit teaches git-send-email to authenticate once and only once at
the beginning of the series.

Signed-off-by: Wincent Colaiuta <win@wincent.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Wincent Colaiuta authored and Junio C Hamano committed Nov 22, 2007
1 parent 060009b commit 5f5b611
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion git-send-email.perl
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ sub format_2822_time {

my $have_email_valid = eval { require Email::Valid; 1 };
my $smtp;
my $auth;

sub unique_email_list(@);
sub cleanup_compose_files();
Expand Down Expand Up @@ -635,7 +636,7 @@ sub send_message
}

if ((defined $smtp_authuser) && (defined $smtp_authpass)) {
$smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
$auth ||= $smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
}
$smtp->mail( $raw_from ) or die $smtp->message;
$smtp->to( @recipients ) or die $smtp->message;
Expand Down

0 comments on commit 5f5b611

Please sign in to comment.