@@ -2485,6 +2485,128 @@ test_expect_success $PREREQ 'leading and trailing whitespaces are removed' '
24852485 test_cmp expected-list actual-list
24862486'
24872487
2488+ test_expect_success $PREREQ ' mailmap support with --to' '
2489+ clean_fake_sendmail &&
2490+ test_config mailmap.file "mailmap.test" &&
2491+ cat >mailmap.test <<-EOF &&
2492+ Some Body <someone@example.com> <someone@example.org>
2493+ EOF
2494+ git format-patch --stdout -1 >a.patch &&
2495+ git send-email \
2496+ --from="Example <nobody@example.com>" \
2497+ --smtp-server="$(pwd)/fake.sendmail" \
2498+ --to=someone@example.org \
2499+ --mailmap \
2500+ a.patch \
2501+ 2>errors >out &&
2502+ grep "^!someone@example\.com!$" commandline1
2503+ '
2504+
2505+ test_expect_success $PREREQ ' sendemail.mailmap configuration' '
2506+ clean_fake_sendmail &&
2507+ test_config mailmap.file "mailmap.test" &&
2508+ test_config sendemail.mailmap "true" &&
2509+ cat >mailmap.test <<-EOF &&
2510+ Some Body <someone@example.com> <someone@example.org>
2511+ EOF
2512+ git format-patch --stdout -1 >a.patch &&
2513+ git send-email \
2514+ --from="Example <nobody@example.com>" \
2515+ --smtp-server="$(pwd)/fake.sendmail" \
2516+ --to=someone@example.org \
2517+ a.patch \
2518+ 2>errors >out &&
2519+ grep "^!someone@example\.com!$" commandline1
2520+ '
2521+
2522+ test_expect_success $PREREQ ' sendemail.mailmap.file configuration' '
2523+ clean_fake_sendmail &&
2524+ test_config sendemail.mailmap.file "mailmap.test" &&
2525+ test_config sendemail.mailmap "true" &&
2526+ cat >mailmap.test <<-EOF &&
2527+ Some Body <someone@example.com> <someone@example.org>
2528+ EOF
2529+ git format-patch --stdout -1 >a.patch &&
2530+ git send-email \
2531+ --from="Example <nobody@example.com>" \
2532+ --smtp-server="$(pwd)/fake.sendmail" \
2533+ --to=someone@example.org \
2534+ a.patch \
2535+ 2>errors >out &&
2536+ grep "^!someone@example\.com!$" commandline1
2537+ '
2538+
2539+ test_expect_success $PREREQ ' sendemail.mailmap identity overrides configuration' '
2540+ clean_fake_sendmail &&
2541+ test_config sendemail.cloud.mailmap.file "mailmap.test" &&
2542+ test_config sendemail.mailmap "false" &&
2543+ test_config sendemail.cloud.mailmap "true" &&
2544+ cat >mailmap.test <<-EOF &&
2545+ Some Body <someone@example.com> <someone@example.org>
2546+ EOF
2547+ git format-patch --stdout -1 >a.patch &&
2548+ git send-email \
2549+ --from="Example <nobody@example.com>" \
2550+ --smtp-server="$(pwd)/fake.sendmail" \
2551+ --identity=cloud \
2552+ --to=someone@example.org \
2553+ a.patch \
2554+ 2>errors >out &&
2555+ grep "^!someone@example\.com!$" commandline1
2556+ '
2557+
2558+ test_expect_success $PREREQ ' --no-mailmap overrides configuration' '
2559+ clean_fake_sendmail &&
2560+ test_config sendemail.cloud.mailmap.file "mailmap.test" &&
2561+ test_config sendemail.mailmap "false" &&
2562+ test_config sendemail.cloud.mailmap "true" &&
2563+ cat >mailmap.test <<-EOF &&
2564+ Some Body <someone@example.com> <someone@example.org>
2565+ EOF
2566+ git format-patch --stdout -1 >a.patch &&
2567+ git send-email \
2568+ --from="Example <nobody@example.com>" \
2569+ --smtp-server="$(pwd)/fake.sendmail" \
2570+ --identity=cloud \
2571+ --to=someone@example.org \
2572+ --no-mailmap \
2573+ a.patch \
2574+ 2>errors >out &&
2575+ grep "^!someone@example\.org!$" commandline1
2576+ '
2577+
2578+ test_expect_success $PREREQ ' mailmap support in To header' '
2579+ clean_fake_sendmail &&
2580+ test_config mailmap.file "mailmap.test" &&
2581+ cat >mailmap.test <<-EOF &&
2582+ <someone@example.com> <someone@example.org>
2583+ EOF
2584+ git format-patch --stdout -1 --to=someone@example.org >a.patch &&
2585+ git send-email \
2586+ --from="Example <nobody@example.com>" \
2587+ --smtp-server="$(pwd)/fake.sendmail" \
2588+ --mailmap \
2589+ a.patch \
2590+ 2>errors >out &&
2591+ grep "^!someone@example\.com!$" commandline1
2592+ '
2593+
2594+ test_expect_success $PREREQ ' mailmap support in Cc header' '
2595+ clean_fake_sendmail &&
2596+ test_config mailmap.file "mailmap.test" &&
2597+ cat >mailmap.test <<-EOF &&
2598+ <someone@example.com> <someone@example.org>
2599+ EOF
2600+ git format-patch --stdout -1 --cc=someone@example.org >a.patch &&
2601+ git send-email \
2602+ --from="Example <nobody@example.com>" \
2603+ --smtp-server="$(pwd)/fake.sendmail" \
2604+ --mailmap \
2605+ a.patch \
2606+ 2>errors >out &&
2607+ grep "^!someone@example\.com!$" commandline1
2608+ '
2609+
24882610test_expect_success $PREREQ ' test using command name with --sendmail-cmd' '
24892611 clean_fake_sendmail &&
24902612 PATH="$PWD:$PATH" \
0 commit comments