File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1407,4 +1407,37 @@ test_expect_success $PREREQ 'sendemail.aliasfile=~/.mailrc' '
14071407 grep "^!someone@example\.org!$" commandline1
14081408'
14091409
1410+ do_xmailer_test () {
1411+ expected=$1 params=$2 &&
1412+ git format-patch -1 &&
1413+ git send-email \
1414+ --from=" Example <nobody@example.com>" \
1415+ --to=someone@example.com \
1416+ --smtp-server=" $( pwd) /fake.sendmail" \
1417+ $params \
1418+ 0001-* .patch \
1419+ 2> errors > out &&
1420+ { grep ' ^X-Mailer:' out || : ; } > mailer &&
1421+ test_line_count = $expected mailer
1422+ }
1423+
1424+ test_expect_success $PREREQ ' --[no-]xmailer without any configuration' '
1425+ do_xmailer_test 1 "--xmailer" &&
1426+ do_xmailer_test 0 "--no-xmailer"
1427+ '
1428+
1429+ test_expect_success $PREREQ ' --[no-]xmailer with sendemail.xmailer=true' '
1430+ test_config sendemail.xmailer true &&
1431+ do_xmailer_test 1 "" &&
1432+ do_xmailer_test 0 "--no-xmailer" &&
1433+ do_xmailer_test 1 "--xmailer"
1434+ '
1435+
1436+ test_expect_success $PREREQ ' --[no-]xmailer with sendemail.xmailer=false' '
1437+ test_config sendemail.xmailer false &&
1438+ do_xmailer_test 0 "" &&
1439+ do_xmailer_test 0 "--no-xmailer" &&
1440+ do_xmailer_test 1 "--xmailer"
1441+ '
1442+
14101443test_done
You can’t perform that action at this time.
0 commit comments