diff options
author | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·20+0100 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2020-11-21T18·45+0100 |
commit | f4609b896fac842433bd495c166d5987852a6a73 (patch) | |
tree | 95511c465c54c4f5d27e5d39ce187e2a1dd82bd3 /third_party/git/t/t9001-send-email.sh | |
parent | 082c006c04343a78d87b6c6ab3608c25d6213c3f (diff) |
merge(3p/git): Merge git subtree at v2.29.2 r/1890
This also bumps the stable nixpkgs to 20.09 as of 2020-11-21, because there is some breakage in the git build related to the netrc credentials helper which someone has taken care of in nixpkgs. The stable channel is not used for anything other than git, so this should be fine. Change-Id: I3575a19dab09e1e9556cf8231d717de9890484fb
Diffstat (limited to 'third_party/git/t/t9001-send-email.sh')
-rwxr-xr-x | third_party/git/t/t9001-send-email.sh | 61 |
1 files changed, 51 insertions, 10 deletions
diff --git a/third_party/git/t/t9001-send-email.sh b/third_party/git/t/t9001-send-email.sh index 997f90b42b3e..a08f72596ab4 100755 --- a/third_party/git/t/t9001-send-email.sh +++ b/third_party/git/t/t9001-send-email.sh @@ -42,7 +42,8 @@ clean_fake_sendmail () { } test_expect_success $PREREQ 'Extract patches' ' - patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1) + patches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1) && + threaded_patches=$(git format-patch -o threaded -s --in-reply-to="format" HEAD^1) ' # Test no confirm early to ensure remaining tests will not hang @@ -1194,8 +1195,8 @@ test_expect_success $PREREQ 'in-reply-to but no threading' ' --to=nobody@example.com \ --in-reply-to="<in-reply-id@example.com>" \ --no-thread \ - $patches | - grep "In-Reply-To: <in-reply-id@example.com>" + $patches >out && + grep "In-Reply-To: <in-reply-id@example.com>" out ' test_expect_success $PREREQ 'no in-reply-to and no threading' ' @@ -1219,6 +1220,17 @@ test_expect_success $PREREQ 'threading but no chain-reply-to' ' grep "In-Reply-To: " stdout ' +test_expect_success $PREREQ 'override in-reply-to if no threading' ' + git send-email \ + --dry-run \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --no-thread \ + --in-reply-to="override" \ + $threaded_patches >stdout && + grep "In-Reply-To: <override>" stdout +' + test_expect_success $PREREQ 'sendemail.to works' ' git config --replace-all sendemail.to "Somebody <somebody@ex.com>" && git send-email \ @@ -1260,7 +1272,7 @@ test_expect_success $PREREQ 'sendemail.identity: --no-identity clears previous i grep "To: default@example.com" stdout ' -test_expect_success $PREREQ 'sendemail.identity: bool identity variable existance overrides' ' +test_expect_success $PREREQ 'sendemail.identity: bool identity variable existence overrides' ' git -c sendemail.identity=cloud \ -c sendemail.xmailer=true \ -c sendemail.cloud.xmailer=false \ @@ -1539,7 +1551,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=quoted-printab --smtp-server="$(pwd)/fake.sendmail" \ email-using-8bit \ 2>errors >out && - sed '1,/^$/d' msgtxt1 >actual && + sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual ' @@ -1556,7 +1568,7 @@ test_expect_success $PREREQ '8-bit and sendemail.transferencoding=base64' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-8bit \ 2>errors >out && - sed '1,/^$/d' msgtxt1 >actual && + sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual ' @@ -1582,7 +1594,7 @@ test_expect_success $PREREQ 'convert from quoted-printable to base64' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-qp \ 2>errors >out && - sed '1,/^$/d' msgtxt1 >actual && + sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual ' @@ -1612,7 +1624,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=quoted-printabl --smtp-server="$(pwd)/fake.sendmail" \ email-using-crlf \ 2>errors >out && - sed '1,/^$/d' msgtxt1 >actual && + sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual ' @@ -1629,7 +1641,7 @@ test_expect_success $PREREQ 'CRLF and sendemail.transferencoding=base64' ' --smtp-server="$(pwd)/fake.sendmail" \ email-using-crlf \ 2>errors >out && - sed '1,/^$/d' msgtxt1 >actual && + sed "1,/^$/d" msgtxt1 >actual && test_cmp expected actual ' @@ -2066,7 +2078,7 @@ test_expect_success $PREREQ 'leading and trailing whitespaces are removed' ' TO1=$(echo "QTo 1 <to1@example.com>" | q_to_tab) && TO2=$(echo "QZto2" | qz_to_tab_space) && CC1=$(echo "cc1" | append_cr) && - BCC1=$(echo "Q bcc1@example.com Q" | q_to_nul) && + BCC1=$(echo " bcc1@example.com Q" | q_to_nul) && git send-email \ --dry-run \ --from=" Example <from@example.com>" \ @@ -2130,4 +2142,33 @@ test_expect_success $PREREQ 'test that send-email works outside a repo' ' "$(pwd)/0001-add-master.patch" ' +test_expect_success $PREREQ 'test that sendmail config is rejected' ' + test_config sendmail.program sendmail && + test_must_fail git send-email \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + HEAD^ 2>err && + test_i18ngrep "found configuration options for '"'"sendmail"'"'" err +' + +test_expect_success $PREREQ 'test that sendmail config rejection is specific' ' + test_config resendmail.program sendmail && + git send-email \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + HEAD^ +' + +test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' ' + test_config sendmail.program sendmail && + test_config sendemail.forbidSendmailVariables false && + git send-email \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --smtp-server="$(pwd)/fake.sendmail" \ + HEAD^ +' + test_done |