2379
test_cmp expected-list actual-list
2380
'
2381
2382
+test_expect_success $PREREQ 'mailmap support with --to' '
2383
+ clean_fake_sendmail &&
2384
+ test_config mailmap.file "mailmap.test" &&
2385
+ cat >mailmap.test <<-EOF &&
2386
+ Some Body <someone@example.com> <someone@example.org>
2387
+ EOF
2388
+ git format-patch --stdout -1 >a.patch &&
2389
+ git send-email \
2390
+ --from="Example <nobody@example.com>" \
2391
+ --smtp-server="$(pwd)/fake.sendmail" \
2392
+ --to=someone@example.org \
2393
+ --mailmap \
2394
+ a.patch \
2395
+ 2>errors >out &&
2396
+ grep "^!someone@example\.com!$" commandline1
2397
+'
2398
+
2399
+test_expect_success $PREREQ 'sendemail.mailmap configuration' '
2400
+ clean_fake_sendmail &&
2401
+ test_config mailmap.file "mailmap.test" &&
2402
+ test_config sendemail.mailmap "true" &&
2403
+ cat >mailmap.test <<-EOF &&
2404
+ Some Body <someone@example.com> <someone@example.org>
2405
+ EOF
2406
+ git format-patch --stdout -1 >a.patch &&
2407
+ git send-email \
2408
+ --from="Example <nobody@example.com>" \
2409
+ --smtp-server="$(pwd)/fake.sendmail" \
2410
+ --to=someone@example.org \
2411
+ a.patch \
2412
+ 2>errors >out &&
2413
+ grep "^!someone@example\.com!$" commandline1
2414
+'
2415
+
2416
+test_expect_success $PREREQ 'sendemail.mailmap.file configuration' '
2417
+ clean_fake_sendmail &&
2418
+ test_config sendemail.mailmap.file "mailmap.test" &&
2419
+ test_config sendemail.mailmap "true" &&
2420
+ cat >mailmap.test <<-EOF &&
2421
+ Some Body <someone@example.com> <someone@example.org>
2422
+ EOF
2423
+ git format-patch --stdout -1 >a.patch &&
2424
+ git send-email \
2425
+ --from="Example <nobody@example.com>" \
2426
+ --smtp-server="$(pwd)/fake.sendmail" \
2427
+ --to=someone@example.org \
2428
+ a.patch \
2429
+ 2>errors >out &&
2430
+ grep "^!someone@example\.com!$" commandline1
2431
+'
2432
+
2433
+test_expect_success $PREREQ 'sendemail.mailmap identity overrides configuration' '
2434
+ clean_fake_sendmail &&
2435
+ test_config sendemail.cloud.mailmap.file "mailmap.test" &&
2436
+ test_config sendemail.mailmap "false" &&
2437
+ test_config sendemail.cloud.mailmap "true" &&
2438
+ cat >mailmap.test <<-EOF &&
2439
+ Some Body <someone@example.com> <someone@example.org>
2440
+ EOF
2441
+ git format-patch --stdout -1 >a.patch &&
2442
+ git send-email \
2443
+ --from="Example <nobody@example.com>" \
2444
+ --smtp-server="$(pwd)/fake.sendmail" \
2445
+ --identity=cloud \
2446
+ --to=someone@example.org \
2447
+ a.patch \
2448
+ 2>errors >out &&
2449
+ grep "^!someone@example\.com!$" commandline1
2450
+'
2451
+
2452
+test_expect_success $PREREQ '--no-mailmap overrides configuration' '
2453
+ clean_fake_sendmail &&
2454
+ test_config sendemail.cloud.mailmap.file "mailmap.test" &&
2455
+ test_config sendemail.mailmap "false" &&
2456
+ test_config sendemail.cloud.mailmap "true" &&
2457
+ cat >mailmap.test <<-EOF &&
2458
+ Some Body <someone@example.com> <someone@example.org>
2459
+ EOF
2460
+ git format-patch --stdout -1 >a.patch &&
2461
+ git send-email \
2462
+ --from="Example <nobody@example.com>" \
2463
+ --smtp-server="$(pwd)/fake.sendmail" \
2464
+ --identity=cloud \
2465
+ --to=someone@example.org \
2466
+ --no-mailmap \
2467
+ a.patch \
2468
+ 2>errors >out &&
2469
+ grep "^!someone@example\.org!$" commandline1
2470
+'
2471
+
2472
+test_expect_success $PREREQ 'mailmap support in To header' '
2473
+ clean_fake_sendmail &&
2474
+ test_config mailmap.file "mailmap.test" &&
2475
+ cat >mailmap.test <<-EOF &&
2476
+ <someone@example.com> <someone@example.org>
2477
+ EOF
2478
+ git format-patch --stdout -1 --to=someone@example.org >a.patch &&
2479
+ git send-email \
2480
+ --from="Example <nobody@example.com>" \
2481
+ --smtp-server="$(pwd)/fake.sendmail" \
2482
+ --mailmap \
2483
+ a.patch \
2484
+ 2>errors >out &&
2485
+ grep "^!someone@example\.com!$" commandline1
2486
+'
2487
+
2488
+test_expect_success $PREREQ 'mailmap support in Cc header' '
2489
+ clean_fake_sendmail &&
2490
+ test_config mailmap.file "mailmap.test" &&
2491
+ cat >mailmap.test <<-EOF &&
2492
+ <someone@example.com> <someone@example.org>
2493
+ EOF
2494
+ git format-patch --stdout -1 --cc=someone@example.org >a.patch &&
2495
+ git send-email \
2496
+ --from="Example <nobody@example.com>" \
2497
+ --smtp-server="$(pwd)/fake.sendmail" \
2498
+ --mailmap \
2499
+ a.patch \
2500
+ 2>errors >out &&
2501
+ grep "^!someone@example\.com!$" commandline1
2502
+'
2503
+
2504
test_expect_success $PREREQ 'test using command name with --sendmail-cmd' '
2505
clean_fake_sendmail &&
2506
PATH="$PWD:$PATH" \