1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-09 18:26:08 +02:00

Merge branch 'ds/send-email-per-message-block' into seen

"git send-email" learned to separate its reports on each message it
sends out with an extra blank line in between.

Comments?

* ds/send-email-per-message-block:
  send-email: make it easy to discern the messages for each patch
  send-email: move newline characters out of a few translatable strings
This commit is contained in:
Junio C Hamano 2024-04-26 09:28:34 -07:00
commit dae7a2848e
2 changed files with 22 additions and 7 deletions

View File

@ -1361,7 +1361,6 @@ sub smtp_host_string {
# Returns 1 if authentication succeeded or was not necessary
# (smtp_user was not specified), and 0 otherwise.
sub smtp_auth_maybe {
if (!defined $smtp_authuser || $auth || (defined $smtp_auth && $smtp_auth eq "none")) {
return 1;
@ -1510,6 +1509,7 @@ sub gen_header {
sub send_message {
my ($recipients_ref, $to, $date, $gitversion, $cc, $ccline, $header) = gen_header();
my @recipients = @$recipients_ref;
my $confirm_shown = 0;
my @sendmail_parameters = ('-i', @recipients);
my $raw_from = $sender;
@ -1555,6 +1555,7 @@ sub send_message {
} elsif (/^a/i) {
$confirm = 'never';
}
$confirm_shown = 1;
}
unshift (@sendmail_parameters, @smtp_server_options);
@ -1576,7 +1577,6 @@ sub send_message {
print $sm "$header\n$message";
close $sm or die $!;
} else {
if (!defined $smtp_server) {
die __("The required SMTP server is not properly defined.")
}
@ -1664,9 +1664,13 @@ sub send_message {
$smtp->code =~ /250|200/ or die sprintf(__("Failed to send %s\n"), $subject).$smtp->message;
}
if ($quiet) {
printf($dry_run ? __("Dry-Sent %s\n") : __("Sent %s\n"), $subject);
print "\n" if ($confirm_shown);
printf($dry_run ? __("Dry-Sent %s") : __("Sent %s"), $subject);
print "\n";
} else {
print($dry_run ? __("Dry-OK. Log says:\n") : __("OK. Log says:\n"));
print "\n";
print($dry_run ? __("Dry-OK. Log says:") : __("OK. Log says:"));
print "\n";
if (!defined $sendmail_cmd && !file_name_is_absolute($smtp_server)) {
print "Server: $smtp_server\n";
print "MAIL FROM:<$raw_from>\n";
@ -1686,10 +1690,11 @@ sub send_message {
print $header, "\n";
if ($smtp) {
print __("Result: "), $smtp->code, ' ',
($smtp->message =~ /\n([^\n]+\n)$/s), "\n";
($smtp->message =~ /\n([^\n]+\n)$/s);
} else {
print __("Result: OK\n");
print __("Result: OK");
}
print "\n";
}
return 1;
@ -1920,7 +1925,7 @@ sub pre_process_file {
sub process_file {
my ($t) = @_;
pre_process_file($t, $quiet);
pre_process_file($t, $quiet);
my $message_was_sent = send_message();
if ($message_was_sent == -1) {

View File

@ -208,6 +208,7 @@ cat >expected-show-all-headers <<\EOF
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -821,6 +822,7 @@ cat >expected-suppress-sob <<\EOF
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -869,6 +871,7 @@ cat >expected-suppress-sob <<\EOF
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -904,6 +907,7 @@ cat >expected-suppress-cccmd <<\EOF
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -940,6 +944,7 @@ test_expect_success $PREREQ 'sendemail.cccmd' '
test_expect_success $PREREQ 'setup expect' '
cat >expected-suppress-all <<\EOF
0001-Second.patch
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -968,6 +973,7 @@ cat >expected-suppress-body <<\EOF
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -1003,6 +1009,7 @@ cat >expected-suppress-body-cccmd <<\EOF
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -1036,6 +1043,7 @@ cat >expected-suppress-sob <<\EOF
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -1071,6 +1079,7 @@ cat >expected-suppress-bodycc <<\EOF
(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'
(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'
(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>
@ -1105,6 +1114,7 @@ cat >expected-suppress-cc <<\EOF
0001-Second.patch
(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'
(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'
Dry-OK. Log says:
Server: relay.example.com
MAIL FROM:<from@example.com>