@matheusbsbs / matheus-bagliano / commits / 5f5b611805
Fork 0

Authenticate only once in git-send-email

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>

Wincent Colaiuta committed Nov 21, 2007 at 13:35 UTC 5f5b611805ed60a303ccbc07ebd9a5bac2dabb92
1 file changed +2 -1
git-send-email.perl
+2 -1
@@ -145,6 +145,7 @@ sub format_2822_time {
145
146 my $have_email_valid = eval { require Email::Valid; 1 };
147 my $smtp;
148 +my $auth;
149
150 sub unique_email_list(@);
151 sub cleanup_compose_files();
@@ -635,7 +636,7 @@ X-Mailer: git-send-email $gitversion
636 }
637
638 if ((defined $smtp_authuser) && (defined $smtp_authpass)) {
638 - $smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
639 + $auth ||= $smtp->auth( $smtp_authuser, $smtp_authpass ) or die $smtp->message;
640 }
641 $smtp->mail( $raw_from ) or die $smtp->message;
642 $smtp->to( @recipients ) or die $smtp->message;