@@ -1334,6 +1334,51 @@ test_expect_success $PREREQ '--force sends cover letter template anyway' '
1334
1334
test -n "$(ls msgtxt*)"
1335
1335
'
1336
1336
1337
+ test_cover_addresses () {
1338
+ header=" $1 "
1339
+ shift
1340
+ clean_fake_sendmail &&
1341
+ rm -fr outdir &&
1342
+ git format-patch --cover-letter -2 -o outdir &&
1343
+ cover=` echo outdir/0000-* .patch` &&
1344
+ mv $cover cover-to-edit.patch &&
1345
+ sed
" s/^From:/$header : [email protected] \nFrom:/" cover-to-edit.patch
> " $cover " &&
1346
+ git send-email \
1347
+ --force \
1348
+ --from=
" Example <[email protected] >" \
1349
+ --no-to --no-cc \
1350
+ " $@ " \
1351
+ --smtp-server=" $( pwd) /fake.sendmail" \
1352
+ outdir/0000-* .patch \
1353
+ outdir/0001-* .patch \
1354
+ outdir/0002-* .patch \
1355
+ 2> errors > out &&
1356
+ grep
" ^$header : [email protected] " msgtxt1
> to1
&&
1357
+ grep
" ^$header : [email protected] " msgtxt2
> to2
&&
1358
+ grep
" ^$header : [email protected] " msgtxt3
> to3
&&
1359
+ test_line_count = 1 to1 &&
1360
+ test_line_count = 1 to2 &&
1361
+ test_line_count = 1 to3
1362
+ }
1363
+
1364
+ test_expect_success $PREREQ ' to-cover adds To to all mail' '
1365
+ test_cover_addresses "To" --to-cover
1366
+ '
1367
+
1368
+ test_expect_success $PREREQ ' cc-cover adds Cc to all mail' '
1369
+ test_cover_addresses "Cc" --cc-cover
1370
+ '
1371
+
1372
+ test_expect_success $PREREQ ' tocover adds To to all mail' '
1373
+ test_config sendemail.tocover true &&
1374
+ test_cover_addresses "To"
1375
+ '
1376
+
1377
+ test_expect_success $PREREQ ' cccover adds Cc to all mail' '
1378
+ test_config sendemail.cccover true &&
1379
+ test_cover_addresses "Cc"
1380
+ '
1381
+
1337
1382
test_expect_success $PREREQ ' sendemail.aliasfiletype=mailrc' '
1338
1383
clean_fake_sendmail &&
1339
1384
echo "alias sbd [email protected] " >.mailrc &&
0 commit comments