Skip to content

Commit 0adc030

Browse files
committed
Merge branch 'jp/maint-send-email-fold' into maint
* jp/maint-send-email-fold: git-send-email.perl: fold multiple entry "Cc:" and multiple single line "RCPT TO:"s
2 parents 64fb90b + 02461e0 commit 0adc030

2 files changed

Lines changed: 78 additions & 22 deletions

File tree

git-send-email.perl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,7 @@ sub send_message
835835
$gitversion = Git::version();
836836
}
837837

838-
my $cc = join(", ", unique_email_list(@cc));
838+
my $cc = join(",\n\t", unique_email_list(@cc));
839839
my $ccline = "";
840840
if ($cc ne '') {
841841
$ccline = "\nCc: $cc";
@@ -976,7 +976,9 @@ sub send_message
976976
if ($smtp_server !~ m#^/#) {
977977
print "Server: $smtp_server\n";
978978
print "MAIL FROM:<$raw_from>\n";
979-
print "RCPT TO:".join(',',(map { "<$_>" } @recipients))."\n";
979+
foreach my $entry (@recipients) {
980+
print "RCPT TO:<$entry>\n";
981+
}
980982
} else {
981983
print "Sendmail: $smtp_server ".join(' ',@sendmail_parameters)."\n";
982984
}

t/t9001-send-email.sh

Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,18 @@ cat >expected-show-all-headers <<\EOF
103103
Dry-OK. Log says:
104104
Server: relay.example.com
105105
MAIL FROM:<from@example.com>
106-
RCPT TO:<to@example.com>,<cc@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<bcc@example.com>
106+
RCPT TO:<to@example.com>
107+
RCPT TO:<cc@example.com>
108+
RCPT TO:<author@example.com>
109+
RCPT TO:<one@example.com>
110+
RCPT TO:<two@example.com>
111+
RCPT TO:<bcc@example.com>
107112
From: Example <from@example.com>
108113
To: to@example.com
109-
Cc: cc@example.com, A <author@example.com>, One <one@example.com>, two@example.com
114+
Cc: cc@example.com,
115+
A <author@example.com>,
116+
One <one@example.com>,
117+
two@example.com
110118
Subject: [PATCH 1/1] Second.
111119
Date: DATE-STRING
112120
Message-Id: MESSAGE-ID-STRING
@@ -164,7 +172,7 @@ test_expect_success 'cccmd works' '
164172
--smtp-server="$(pwd)/fake.sendmail" \
165173
cccmd.patch \
166174
&&
167-
grep ^Cc:.*cccmd@example.com msgtxt1
175+
grep "^ cccmd@example.com" msgtxt1
168176
'
169177

170178
z8=zzzzzzzz
@@ -278,10 +286,17 @@ cat >expected-suppress-sob <<\EOF
278286
Dry-OK. Log says:
279287
Server: relay.example.com
280288
MAIL FROM:<from@example.com>
281-
RCPT TO:<to@example.com>,<cc@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
289+
RCPT TO:<to@example.com>
290+
RCPT TO:<cc@example.com>
291+
RCPT TO:<author@example.com>
292+
RCPT TO:<one@example.com>
293+
RCPT TO:<two@example.com>
282294
From: Example <from@example.com>
283295
To: to@example.com
284-
Cc: cc@example.com, A <author@example.com>, One <one@example.com>, two@example.com
296+
Cc: cc@example.com,
297+
A <author@example.com>,
298+
One <one@example.com>,
299+
two@example.com
285300
Subject: [PATCH 1/1] Second.
286301
Date: DATE-STRING
287302
Message-Id: MESSAGE-ID-STRING
@@ -318,10 +333,15 @@ cat >expected-suppress-sob <<\EOF
318333
Dry-OK. Log says:
319334
Server: relay.example.com
320335
MAIL FROM:<from@example.com>
321-
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
336+
RCPT TO:<to@example.com>
337+
RCPT TO:<author@example.com>
338+
RCPT TO:<one@example.com>
339+
RCPT TO:<two@example.com>
322340
From: Example <from@example.com>
323341
To: to@example.com
324-
Cc: A <author@example.com>, One <one@example.com>, two@example.com
342+
Cc: A <author@example.com>,
343+
One <one@example.com>,
344+
two@example.com
325345
Subject: [PATCH 1/1] Second.
326346
Date: DATE-STRING
327347
Message-Id: MESSAGE-ID-STRING
@@ -344,10 +364,17 @@ cat >expected-suppress-cccmd <<\EOF
344364
Dry-OK. Log says:
345365
Server: relay.example.com
346366
MAIL FROM:<from@example.com>
347-
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<committer@example.com>
367+
RCPT TO:<to@example.com>
368+
RCPT TO:<author@example.com>
369+
RCPT TO:<one@example.com>
370+
RCPT TO:<two@example.com>
371+
RCPT TO:<committer@example.com>
348372
From: Example <from@example.com>
349373
To: to@example.com
350-
Cc: A <author@example.com>, One <one@example.com>, two@example.com, C O Mitter <committer@example.com>
374+
Cc: A <author@example.com>,
375+
One <one@example.com>,
376+
two@example.com,
377+
C O Mitter <committer@example.com>
351378
Subject: [PATCH 1/1] Second.
352379
Date: DATE-STRING
353380
Message-Id: MESSAGE-ID-STRING
@@ -392,10 +419,17 @@ cat >expected-suppress-body <<\EOF
392419
Dry-OK. Log says:
393420
Server: relay.example.com
394421
MAIL FROM:<from@example.com>
395-
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<cc-cmd@example.com>
422+
RCPT TO:<to@example.com>
423+
RCPT TO:<author@example.com>
424+
RCPT TO:<one@example.com>
425+
RCPT TO:<two@example.com>
426+
RCPT TO:<cc-cmd@example.com>
396427
From: Example <from@example.com>
397428
To: to@example.com
398-
Cc: A <author@example.com>, One <one@example.com>, two@example.com, cc-cmd@example.com
429+
Cc: A <author@example.com>,
430+
One <one@example.com>,
431+
two@example.com,
432+
cc-cmd@example.com
399433
Subject: [PATCH 1/1] Second.
400434
Date: DATE-STRING
401435
Message-Id: MESSAGE-ID-STRING
@@ -416,10 +450,15 @@ cat >expected-suppress-body-cccmd <<\EOF
416450
Dry-OK. Log says:
417451
Server: relay.example.com
418452
MAIL FROM:<from@example.com>
419-
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
453+
RCPT TO:<to@example.com>
454+
RCPT TO:<author@example.com>
455+
RCPT TO:<one@example.com>
456+
RCPT TO:<two@example.com>
420457
From: Example <from@example.com>
421458
To: to@example.com
422-
Cc: A <author@example.com>, One <one@example.com>, two@example.com
459+
Cc: A <author@example.com>,
460+
One <one@example.com>,
461+
two@example.com
423462
Subject: [PATCH 1/1] Second.
424463
Date: DATE-STRING
425464
Message-Id: MESSAGE-ID-STRING
@@ -440,10 +479,15 @@ cat >expected-suppress-sob <<\EOF
440479
Dry-OK. Log says:
441480
Server: relay.example.com
442481
MAIL FROM:<from@example.com>
443-
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>
482+
RCPT TO:<to@example.com>
483+
RCPT TO:<author@example.com>
484+
RCPT TO:<one@example.com>
485+
RCPT TO:<two@example.com>
444486
From: Example <from@example.com>
445487
To: to@example.com
446-
Cc: A <author@example.com>, One <one@example.com>, two@example.com
488+
Cc: A <author@example.com>,
489+
One <one@example.com>,
490+
two@example.com
447491
Subject: [PATCH 1/1] Second.
448492
Date: DATE-STRING
449493
Message-Id: MESSAGE-ID-STRING
@@ -466,10 +510,17 @@ cat >expected-suppress-bodycc <<\EOF
466510
Dry-OK. Log says:
467511
Server: relay.example.com
468512
MAIL FROM:<from@example.com>
469-
RCPT TO:<to@example.com>,<author@example.com>,<one@example.com>,<two@example.com>,<committer@example.com>
513+
RCPT TO:<to@example.com>
514+
RCPT TO:<author@example.com>
515+
RCPT TO:<one@example.com>
516+
RCPT TO:<two@example.com>
517+
RCPT TO:<committer@example.com>
470518
From: Example <from@example.com>
471519
To: to@example.com
472-
Cc: A <author@example.com>, One <one@example.com>, two@example.com, C O Mitter <committer@example.com>
520+
Cc: A <author@example.com>,
521+
One <one@example.com>,
522+
two@example.com,
523+
C O Mitter <committer@example.com>
473524
Subject: [PATCH 1/1] Second.
474525
Date: DATE-STRING
475526
Message-Id: MESSAGE-ID-STRING
@@ -489,10 +540,13 @@ cat >expected-suppress-cc <<\EOF
489540
Dry-OK. Log says:
490541
Server: relay.example.com
491542
MAIL FROM:<from@example.com>
492-
RCPT TO:<to@example.com>,<author@example.com>,<committer@example.com>
543+
RCPT TO:<to@example.com>
544+
RCPT TO:<author@example.com>
545+
RCPT TO:<committer@example.com>
493546
From: Example <from@example.com>
494547
To: to@example.com
495-
Cc: A <author@example.com>, C O Mitter <committer@example.com>
548+
Cc: A <author@example.com>,
549+
C O Mitter <committer@example.com>
496550
Subject: [PATCH 1/1] Second.
497551
Date: DATE-STRING
498552
Message-Id: MESSAGE-ID-STRING
@@ -605,7 +659,7 @@ test_expect_success 'utf8 Cc is rfc2047 encoded' '
605659
--to=nobody@example.com \
606660
--smtp-server="$(pwd)/fake.sendmail" \
607661
outdir/*.patch &&
608-
grep "^Cc:" msgtxt1 |
662+
grep "^ " msgtxt1 |
609663
grep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"
610664
'
611665

0 commit comments

Comments
 (0)