(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'git send-email'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:PREREQ) op:Equal rhs:{(DQ (PERL))} spids:[17])] spids: [17] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'prepare reference tree'>)} { (SQ <'\n'> <'\techo "1A quick brown fox jumps over the" >file &&\n'> <'\techo "lazy dog" >>file &&\n'> <'\tgit add file &&\n'> <'\tGIT_AUTHOR_NAME="A" git commit -a -m "Initial."\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Setup helper tool'>)} { (SQ <'\n'> <'\twrite_script fake.sendmail <<-\\EOF &&\n'> <'\tshift\n'> <'\toutput=1\n'> <'\twhile test -f commandline$output\n'> <'\tdo\n'> <'\t\toutput=$(($output+1))\n'> <'\tdone\n'> <'\tfor a\n'> <'\tdo\n'> <'\t\techo "!$a!"\n'> <'\tdone >commandline$output\n'> <'\tcat >"msgtxt$output"\n'> <'\tEOF\n'> <'\tgit add fake.sendmail &&\n'> <'\tGIT_AUTHOR_NAME="A" git commit -a -m "Second."\n'> ) } ) (FuncDef name: clean_fake_sendmail body: (BraceGroup children: [(C {(rm)} {(-f)} {(commandline) (Lit_Other '*')} {(msgtxt) (Lit_Other '*')})] spids: [73] ) spids: [68 72] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Extract patches'>)} { (SQ <'\n'> < '\tpatches=$(git format-patch -s --cc="One <one@example.com>" --cc=two@example.com -n HEAD^1)\n' > ) } ) (FuncDef name: test_no_confirm body: (BraceGroup children: [ (C {(rm)} {(-f)} {(no_confirm_okay)}) (AndOr ops: [Op_DAmp Op_DAmp] children: [ (Pipeline children: [ (C {(echo)} {(n)}) (SimpleCommand words: [ {(git)} {(send-email)} {(--from) (Lit_Other '=') (DQ ('Example <from@example.com>'))} {(--to) (Lit_Other '=') (nobody) (Lit_Other '@') (example.com)} {(--smtp-server) (Lit_Other '=') (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [159 161] ) (/fake.sendmail) ) } {($ VSub_At '$@')} {($ VSub_Name '$patches')} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(stdout)} spids: [173] ) ] more_env: [(env_pair name:GIT_SEND_EMAIL_NOTTY val:{(1)} spids:[129])] ) ] negated: F ) (C {(test_must_fail)} {(grep)} {(DQ ('Send this email'))} {(stdout)}) (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(no_confirm_okay)} spids: [192] ) ] ) ] ) ] spids: [111] ) spids: [106 110] ) (FuncDef name: check_no_confirm body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(Pipeline children:[(C {(test)} {(-f)} {(no_confirm_okay)})] negated:T)] action: [ (C {(say)} {(SQ <'confirm test failed; skipping remaining tests to prevent hanging'>)} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PREREQ) op: Equal rhs: {(DQ ($ VSub_Name '$PREREQ') (',CHECK_NO_CONFIRM'))} spids: [230] ) ] spids: [230] ) ] spids: [16777215 220] ) ] spids: [16777215 237] ) (ControlFlow token:<ControlFlow_Return return> arg_word:{(0)}) ] spids: [206] ) spids: [201 205] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'No confirm with --suppress-cc'>)} {(SQ <'\n'> <'\ttest_no_confirm --suppress-cc=sob &&\n'> <'\tcheck_no_confirm\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'No confirm with --confirm=never'>)} {(SQ <'\n'> <'\ttest_no_confirm --confirm=never &&\n'> <'\tcheck_no_confirm\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'No confirm with sendemail.confirm=never'>)} { (SQ <'\n'> <'\tgit config sendemail.confirm never &&\n'> <'\ttest_no_confirm --compose --subject=foo &&\n'> <'\tcheck_no_confirm\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Send patches'>)} { (SQ <'\n'> < '\tgit send-email --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors\n' > ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\t!nobody@example.com!\n'> <'\t!author@example.com!\n'> <'\t!one@example.com!\n'> <'\t!two@example.com!\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Verify commandline'>)} {(SQ <'\n'> <'\ttest_cmp expected commandline1\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Send patches with --envelope-sender'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> < '\tgit send-email --envelope-sender="Patch Contributor <patch@example.com>" --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors\n' > ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\t!patch@example.com!\n'> <'\t!-i!\n'> <'\t!nobody@example.com!\n'> <'\t!author@example.com!\n'> <'\t!one@example.com!\n'> <'\t!two@example.com!\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Verify commandline'>)} {(SQ <'\n'> <'\ttest_cmp expected commandline1\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Send patches with --envelope-sender=auto'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> < '\tgit send-email --envelope-sender=auto --suppress-cc=sob --from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors\n' > ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\t!nobody@example.com!\n'> <'\t!-i!\n'> <'\t!nobody@example.com!\n'> <'\t!author@example.com!\n'> <'\t!one@example.com!\n'> <'\t!two@example.com!\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Verify commandline'>)} {(SQ <'\n'> <'\ttest_cmp expected commandline1\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect for cc trailer'>)} { (DQ ('\n') ('cat >expected-cc <<') (Lit_Other '\\') ('EOF\n') ('!recipient@example.com!\n') ('!author@example.com!\n') ('!one@example.com!\n') ('!two@example.com!\n') ('!three@example.com!\n') ('!four@example.com!\n') ('!five@example.com!\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'cc trailer with various syntax'>)} { (SQ <'\n'> <'\ttest_commit cc-trailer &&\n'> <'\ttest_when_finished "git reset --hard HEAD^" &&\n'> <'\tgit commit --amend -F - <<-EOF &&\n'> <'\tTest Cc: trailers.\n'> <'\n'> <'\tCc: one@example.com\n'> <'\tCc: <two@example.com> # this is part of the name\n'> <'\tCc: <three@example.com>, <four@example.com> # not.five@example.com\n'> <'\tCc: "Some # Body" <five@example.com> [part.of.name.too]\n'> <'\tEOF\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email -1 --to=recipient@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" &&\n'> <'\ttest_cmp expected-cc commandline1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-show-all-headers <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ( "(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n" ) ("(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n") ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<cc@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('RCPT TO:<bcc@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: cc@example.com,\n') ('\tA <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('In-Reply-To: <unique-message-id@example.com>\n') ('References: <unique-message-id@example.com>\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (FuncDef name: test_suppress_self body: (BraceGroup children: [ (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (C {(test_commit)} {($ VSub_Number '$3')}) (C {(test_when_finished)} {(DQ ('git reset --hard HEAD^'))}) (SimpleCommand words: [{(write_script)} {(cccmd-sed)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: { (DQ ('sed -n -e s/^cccmd--//p ') (Right_DoubleQuote '"') (EscapedLiteralPart token: <Lit_EscapedChar '\\$'> ) (1) (Right_DoubleQuote '"') ('\n') ) } do_expansion: True here_end: EOF was_filled: T spids: [571] ) ] ) (C {(git)} {(commit)} {(--amend)} {(--author) (Lit_Other '=') (DQ ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>')) } {(-F)} {(-)} ) (C {(clean_fake_sendmail)}) (SimpleCommand words: [{(git)} {(format-patch)} {(--stdout)} {(-1)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (suppress-self-) ($ VSub_Number '$3') (.patch))} spids: [620] ) ] ) (C {(git)} {(send-email)} {(--from) (Lit_Other '=') (DQ ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>')) } {(--to) (Lit_Other '=') (nobody) (Lit_Other '@') (example.com)} {(--cc-cmd) (Lit_Other '=') (./cccmd-sed)} {(--suppress-cc) (Lit_Other '=') (self)} {(--smtp-server) (Lit_Other '=') (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [669 671] ) (/fake.sendmail) ) } {(suppress-self-) ($ VSub_Number '$3') (.patch)} ) (C {(mv)} {(msgtxt1)} {(msgtxt1-) ($ VSub_Number '$3')}) (SimpleCommand words: [{(sed)} {(-e)} {(SQ <'/^$/q'>)} {(msgtxt1-) ($ VSub_Number '$3')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (msghdr1-) ($ VSub_Number '$3'))} spids: [706] ) ] ) (SimpleCommand redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (expected-no-cc-) ($ VSub_Number '$3'))} spids: [715] ) ] ) (Subshell child: (CommandList children: [ (Sentence child: (SimpleCommand words: [{(grep)} {(SQ <'^Cc:'>)} {(msghdr1-) ($ VSub_Number '$3')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (actual-no-cc-) ($ VSub_Number '$3'))} spids: [735] ) ] ) terminator: <Op_Semi ';'> ) (C {(test_cmp)} {(expected-no-cc-) ($ VSub_Number '$3')} {(actual-no-cc-) ($ VSub_Number '$3')} ) ] ) spids: [725 750] ) ] ) ] spids: [547] ) spids: [542 546] ) (FuncDef name: test_suppress_self_unquoted body: (BraceGroup children: [ (SimpleCommand words: [ {(test_suppress_self)} {(DQ ($ VSub_Number '$1'))} {(DQ ($ VSub_Number '$2'))} {(DQ (unquoted-) ($ VSub_Number '$3'))} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: { (DQ ('test suppress-cc.self unquoted-') ($ VSub_Number '$3') (' with name ') ($ VSub_Number '$1') (' email ') ($ VSub_Number '$2') ('\n') ('\n') (unquoted-) ($ VSub_Number '$3') ('\n') ('\n') (cccmd--) ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>\n') ('\n') ('Cc: ') ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>\n') ('Signed-off-by: ') ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>\n') ) } do_expansion: True here_end: EOF was_filled: T spids: [778] ) ] ) ] spids: [760] ) spids: [755 759] ) (FuncDef name: test_suppress_self_quoted body: (BraceGroup children: [ (SimpleCommand words: [ {(test_suppress_self)} {(DQ ($ VSub_Number '$1'))} {(DQ ($ VSub_Number '$2'))} {(DQ (quoted-) ($ VSub_Number '$3'))} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: { (DQ ('test suppress-cc.self quoted-') ($ VSub_Number '$3') (' with name ') ($ VSub_Number '$1') (' email ') ($ VSub_Number '$2') ('\n') ('\n') (quoted-) ($ VSub_Number '$3') ('\n') ('\n') (cccmd--) (Right_DoubleQuote '"') ($ VSub_Number '$1') (Right_DoubleQuote '"') (' <') ($ VSub_Number '$2') ('>\n') ('\n') ('Cc: ') ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>\n') ('Cc: ') (Right_DoubleQuote '"') ($ VSub_Number '$1') (Right_DoubleQuote '"') (' <') ($ VSub_Number '$2') ('>\n') ('Signed-off-by: ') ($ VSub_Number '$1') (' <') ($ VSub_Number '$2') ('>\n') ('Signed-off-by: ') (Right_DoubleQuote '"') ($ VSub_Number '$1') (Right_DoubleQuote '"') (' <') ($ VSub_Number '$2') ('>\n') ) } do_expansion: True here_end: EOF was_filled: T spids: [836] ) ] ) ] spids: [818] ) spids: [813 817] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'self name is suppressed'>)} { (DQ ('\n') ("\ttest_suppress_self_unquoted 'A U Thor' 'author@example.com' ") ("\t\t'self_name_suppressed'\n") ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'self name with dot is suppressed'>)} { (DQ ('\n') ("\ttest_suppress_self_quoted 'A U. Thor' 'author@example.com' ") ("\t\t'self_name_dot_suppressed'\n") ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'non-ascii self name is suppressed'>)} { (DQ ('\n') ( "\ttest_suppress_self_quoted 'F\xc3\xbc\xc3\xb1n\xc3\xbd N\xc3\xa2m\xc3\xa9' 'odd_?=mail@example.com' " ) ("\t\t'non_ascii_self_suppressed'\n") ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'long non-ascii self name is suppressed'>)} { (DQ ('\n') ( "\ttest_suppress_self_quoted '\xc6\x91\xc3\xbc\xc3\xb1n\xc3\xad\xc4\x99\xc5\x99 \xe2\x82\xac. N\xc3\xa2\xe1\xb9\x81\xc3\xa9' 'odd_?=mail@example.com' " ) ("\t\t'long_non_ascii_self_suppressed'\n") ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sanitized self name is suppressed'>)} { (DQ ('\n') ("\ttest_suppress_self_unquoted '") (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('A U. Thor') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ("' 'author@example.com' ") ("\t\t'self_name_sanitized_suppressed'\n") ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Show all headers'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--suppress-cc=sob \\\n'> <'\t\t--from="Example <from@example.com>" \\\n'> <'\t\t--to=to@example.com \\\n'> <'\t\t--cc=cc@example.com \\\n'> <'\t\t--bcc=bcc@example.com \\\n'> <'\t\t--in-reply-to="<unique-message-id@example.com>" \\\n'> <'\t\t--smtp-server relay.example.com \\\n'> <'\t\t$patches |\n'> <'\tsed\t-e "s/^\\(Date:\\).*/\\1 DATE-STRING/" \\\n'> <'\t\t-e "s/^\\(Message-Id:\\).*/\\1 MESSAGE-ID-STRING/" \\\n'> <'\t\t-e "s/^\\(X-Mailer:\\).*/\\1 X-MAILER-STRING/" \\\n'> <'\t\t>actual-show-all-headers &&\n'> <'\ttest_cmp expected-show-all-headers actual-show-all-headers\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Prompting works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\t(echo "to@example.com"\n'> <'\t echo ""\n'> <'\t) | GIT_SEND_EMAIL_NOTTY=1 git send-email \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches \\\n'> <'\t\t2>errors &&\n'> <'\t\tgrep "^From: A U Thor <author@example.com>\\$" msgtxt1 &&\n'> <'\t\tgrep "^To: to@example.com\\$" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ') (Lit_Comma ',') (AUTOIDENT)} {(SQ <'implicit ident is allowed'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\t(sane_unset GIT_AUTHOR_NAME &&\n'> <'\tsane_unset GIT_AUTHOR_EMAIL &&\n'> <'\tsane_unset GIT_COMMITTER_NAME &&\n'> <'\tsane_unset GIT_COMMITTER_EMAIL &&\n'> <'\tGIT_SEND_EMAIL_NOTTY=1 git send-email \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t--to=to@example.com \\\n'> <'\t\t$patches </dev/null 2>errors\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ') (Lit_Comma ',') (KW_Bang '!') (AUTOIDENT)} {(SQ <'broken implicit ident aborts send-email'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\t(sane_unset GIT_AUTHOR_NAME &&\n'> <'\tsane_unset GIT_AUTHOR_EMAIL &&\n'> <'\tsane_unset GIT_COMMITTER_NAME &&\n'> <'\tsane_unset GIT_COMMITTER_EMAIL &&\n'> <'\tGIT_SEND_EMAIL_NOTTY=1 && export GIT_SEND_EMAIL_NOTTY &&\n'> <'\ttest_must_fail git send-email \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t--to=to@example.com \\\n'> <'\t\t$patches </dev/null 2>errors &&\n'> <'\ttest_i18ngrep "tell me who you are" errors\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup tocmd and cccmd scripts'>)} { (SQ <'\n'> <'\twrite_script tocmd-sed <<-\\EOF &&\n'> <'\tsed -n -e "s/^tocmd--//p" "$1"\n'> <'\tEOF\n'> <'\twrite_script cccmd-sed <<-\\EOF\n'> <'\tsed -n -e "s/^cccmd--//p" "$1"\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'tocmd works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tcp $patches tocmd.patch &&\n'> <'\techo tocmd--tocmd@example.com >>tocmd.patch &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to-cmd=./tocmd-sed \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\ttocmd.patch \\\n'> <'\t\t&&\n'> <'\tgrep "^To: tocmd@example.com" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'cccmd works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tcp $patches cccmd.patch &&\n'> <'\techo "cccmd-- cccmd@example.com" >>cccmd.patch &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--cc-cmd=./cccmd-sed \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\tcccmd.patch \\\n'> <'\t\t&&\n'> <'\tgrep "^\tcccmd@example.com" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'reject long lines'>)} { (SQ <'\n'> <'\tz8=zzzzzzzz &&\n'> <'\tz64=$z8$z8$z8$z8$z8$z8$z8$z8 &&\n'> <'\tz512=$z64$z64$z64$z64$z64$z64$z64$z64 &&\n'> <'\tclean_fake_sendmail &&\n'> <'\tcp $patches longline.patch &&\n'> <'\techo $z512$z512 >>longline.patch &&\n'> <'\ttest_must_fail git send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches longline.patch \\\n'> <'\t\t2>errors &&\n'> <'\tgrep longline.patch errors\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'no patch was sent'>)} {(SQ <'\n'> <'\t! test -e commandline1\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Author From: in message body'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tsed "1,/^\\$/d" <msgtxt1 >msgbody1 &&\n'> <'\tgrep "From: A <author@example.com>" msgbody1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Author From: not in message body'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="A <author@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tsed "1,/^\\$/d" <msgtxt1 >msgbody1 &&\n'> <'\t! grep "From: A <author@example.com>" msgbody1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'allow long lines with --no-validate'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t--no-validate \\\n'> <'\t\t$patches longline.patch \\\n'> <'\t\t2>errors\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Invalid In-Reply-To'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--in-reply-to=" " \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches \\\n'> <'\t\t2>errors &&\n'> <'\t! grep "^In-Reply-To: < *>" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'Valid In-Reply-To when prompting'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\t(echo "From Example <from@example.com>"\n'> <'\t echo "To Example <to@example.com>"\n'> <'\t echo ""\n'> <'\t) | GIT_SEND_EMAIL_NOTTY=1 git send-email \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches 2>errors &&\n'> <'\t! grep "^In-Reply-To: < *>" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'In-Reply-To without --chain-reply-to'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "<unique-message-id@example.com>" >expect &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--no-chain-reply-to \\\n'> <'\t\t--in-reply-to="$(cat expect)" \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches $patches $patches \\\n'> <'\t\t2>errors &&\n'> <'\t# The first message is a reply to --in-reply-to\n'> <'\tsed -n -e "s/^In-Reply-To: *\\(.*\\)/\\1/p" msgtxt1 >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\t# Second and subsequent messages are replies to the first one\n'> <'\tsed -n -e "s/^Message-Id: *\\(.*\\)/\\1/p" msgtxt1 >expect &&\n'> <'\tsed -n -e "s/^In-Reply-To: *\\(.*\\)/\\1/p" msgtxt2 >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\tsed -n -e "s/^In-Reply-To: *\\(.*\\)/\\1/p" msgtxt3 >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'In-Reply-To with --chain-reply-to'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "<unique-message-id@example.com>" >expect &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--chain-reply-to \\\n'> <'\t\t--in-reply-to="$(cat expect)" \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches $patches $patches \\\n'> <'\t\t2>errors &&\n'> <'\tsed -n -e "s/^In-Reply-To: *\\(.*\\)/\\1/p" msgtxt1 >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\tsed -n -e "s/^Message-Id: *\\(.*\\)/\\1/p" msgtxt1 >expect &&\n'> <'\tsed -n -e "s/^In-Reply-To: *\\(.*\\)/\\1/p" msgtxt2 >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\tsed -n -e "s/^Message-Id: *\\(.*\\)/\\1/p" msgtxt2 >expect &&\n'> <'\tsed -n -e "s/^In-Reply-To: *\\(.*\\)/\\1/p" msgtxt3 >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup fake editor'>)} { (SQ <'\n'> <'\twrite_script fake-editor <<-\\EOF\n'> <'\techo fake edit >>"$1"\n'> <'\tEOF\n'>) } ) (C {(test_set_editor)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [1373 1375] ) (/fake-editor) ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t--compose --subject foo \\\n'> <'\t--from="Example <nobody@example.com>" \\\n'> <'\t--to=nobody@example.com \\\n'> <'\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t$patches \\\n'> <'\t2>errors\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'first message is compose text'>)} {(SQ <'\n'> <'\tgrep "^fake edit" msgtxt1\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'second message is patch'>)} {(SQ <'\n'> <'\tgrep "Subject:.*Second" msgtxt2\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-sob <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ("(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n") ( "(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n" ) ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<cc@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: cc@example.com,\n') ('\tA <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (FuncDef name: replace_variable_fields body: (BraceGroup children: [ (C {(sed)} {(-e)} { (DQ ('s/^') (Lit_Other '\\') ('(Date:') (Lit_Other '\\') (').*/') (Lit_Other '\\') ('1 DATE-STRING/') ) } {(-e)} { (DQ ('s/^') (Lit_Other '\\') ('(Message-Id:') (Lit_Other '\\') (').*/') (Lit_Other '\\') ('1 MESSAGE-ID-STRING/') ) } {(-e)} { (DQ ('s/^') (Lit_Other '\\') ('(X-Mailer:') (Lit_Other '\\') (').*/') (Lit_Other '\\') ('1 X-MAILER-STRING/') ) } ) ] spids: [1475] ) spids: [1470 1474] ) (FuncDef name: test_suppression body: (BraceGroup children: [ (AndOr ops: [Op_DAmp] children: [ (Pipeline children: [ (C {(git)} {(send-email)} {(--dry-run)} {(--suppress-cc) (Lit_Other '=') ($ VSub_Number '$1')} { (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id: VTest_Plus arg_word: {(DQ ('--suppress-cc=') ($ VSub_Number '$2'))} ) spids: [1545 1552] ) } {(--from) (Lit_Other '=') (DQ ('Example <from@example.com>'))} {(--to) (Lit_Other '=') (to) (Lit_Other '@') (example.com)} {(--smtp-server)} {(relay.example.com)} {($ VSub_Name '$patches')} ) (SimpleCommand words: [{(replace_variable_fields)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(actual-suppress-) ($ VSub_Number '$1') (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id: VTest_Plus arg_word: {(DQ (-) ($ VSub_Number '$2'))} ) spids: [1589 1596] ) } spids: [1586] ) ] ) ] negated: F ) (C {(test_cmp)} {(expected-suppress-) ($ VSub_Number '$1') (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(DQ (-) ($ VSub_Number '$2'))}) spids: [1605 1612] ) } {(actual-suppress-) ($ VSub_Number '$1') (BracedVarSub token: <VSub_Number 2> suffix_op: (StringUnary op_id:VTest_Plus arg_word:{(DQ (-) ($ VSub_Number '$2'))}) spids: [1616 1623] ) } ) ] ) ] spids: [1528] ) spids: [1523 1527] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.cc set'>)} {(SQ <'\n'> <'\tgit config sendemail.cc cc@example.com &&\n'> <'\ttest_suppression sob\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-sob <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ("(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n") ( "(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n" ) ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.cc unset'>)} {(SQ <'\n'> <'\tgit config --unset sendemail.cc &&\n'> <'\ttest_suppression sob\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-cccmd <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ("(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n") ( "(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n" ) ( "(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'\n" ) ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('RCPT TO:<committer@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com,\n') ('\tC O Mitter <committer@example.com>\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <sendemail.cccmd>)} { (SQ <'\n'> <'\twrite_script cccmd <<-\\EOF &&\n'> <'\techo cc-cmd@example.com\n'> <'\tEOF\n'> <'\tgit config sendemail.cccmd ./cccmd &&\n'> <'\ttest_suppression cccmd\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'cat >expected-suppress-all <<\\EOF\n'> <'0001-Second.patch\n'> <'Dry-OK. Log says:\n'> <'Server: relay.example.com\n'> <'MAIL FROM:<from@example.com>\n'> <'RCPT TO:<to@example.com>\n'> <'From: Example <from@example.com>\n'> <'To: to@example.com\n'> <'Subject: [PATCH 1/1] Second.\n'> <'Date: DATE-STRING\n'> <'Message-Id: MESSAGE-ID-STRING\n'> <'X-Mailer: X-MAILER-STRING\n'> <'\n'> <'Result: OK\n'> <'EOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--suppress-cc=all'>)} {(SQ <'\n'> <'\ttest_suppression all\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-body <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ("(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n") ( "(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n" ) ("(cc-cmd) Adding cc: cc-cmd@example.com from: './cccmd'\n") ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('RCPT TO:<cc-cmd@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com,\n') ('\tcc-cmd@example.com\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--suppress-cc=body'>)} {(SQ <'\n'> <'\ttest_suppression body\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-body-cccmd <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ( "(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n" ) ("(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n") ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--suppress-cc=body --suppress-cc=cccmd'>)} {(SQ <'\n'> <'\ttest_suppression body cccmd\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-sob <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ("(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n") ( "(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n" ) ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--suppress-cc=sob'>)} { (SQ <'\n'> <'\ttest_might_fail git config --unset sendemail.cccmd &&\n'> <'\ttest_suppression sob\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-bodycc <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ( "(mbox) Adding cc: One <one@example.com> from line 'Cc: One <one@example.com>, two@example.com'\n" ) ("(mbox) Adding cc: two@example.com from line 'Cc: One <one@example.com>, two@example.com'\n") ( "(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'\n" ) ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<one@example.com>\n') ('RCPT TO:<two@example.com>\n') ('RCPT TO:<committer@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tOne <one@example.com>,\n') ('\ttwo@example.com,\n') ('\tC O Mitter <committer@example.com>\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--suppress-cc=bodycc'>)} {(SQ <'\n'> <'\ttest_suppression bodycc\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ('cat >expected-suppress-cc <<') (Lit_Other '\\') ('EOF\n') ('0001-Second.patch\n') ("(mbox) Adding cc: A <author@example.com> from line 'From: A <author@example.com>'\n") ( "(body) Adding cc: C O Mitter <committer@example.com> from line 'Signed-off-by: C O Mitter <committer@example.com>'\n" ) ('Dry-OK. Log says:\n') ('Server: relay.example.com\n') ('MAIL FROM:<from@example.com>\n') ('RCPT TO:<to@example.com>\n') ('RCPT TO:<author@example.com>\n') ('RCPT TO:<committer@example.com>\n') ('From: Example <from@example.com>\n') ('To: to@example.com\n') ('Cc: A <author@example.com>,\n') ('\tC O Mitter <committer@example.com>\n') ('Subject: [PATCH 1/1] Second.\n') ('Date: DATE-STRING\n') ('Message-Id: MESSAGE-ID-STRING\n') ('X-Mailer: X-MAILER-STRING\n') ('\n') ('Result: OK\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--suppress-cc=cc'>)} {(SQ <'\n'> <'\ttest_suppression cc\n'>)} ) (FuncDef name: test_confirm body: (BraceGroup children: [ (AndOr ops: [Op_DAmp] children: [ (Pipeline children: [ (C {(echo)} {(y)}) (SimpleCommand words: [ {(git)} {(send-email)} {(--from) (Lit_Other '=') (DQ ('Example <nobody@example.com>'))} {(--to) (Lit_Other '=') (nobody) (Lit_Other '@') (example.com)} {(--smtp-server) (Lit_Other '=') (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [2114 2116] ) (/fake.sendmail) ) } {($ VSub_At '$@')} {($ VSub_Name '$patches')} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(stdout)} spids: [2126] ) ] more_env: [(env_pair name:GIT_SEND_EMAIL_NOTTY val:{(1)} spids:[2084])] ) ] negated: F ) (C {(grep)} {(DQ ('Send this email'))} {(stdout)}) ] ) ] spids: [2073] ) spids: [2068 2072] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--confirm=always'>)} {(SQ <'\n'> <'\ttest_confirm --confirm=always --suppress-cc=all\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--confirm=auto'>)} {(SQ <'\n'> <'\ttest_confirm --confirm=auto\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--confirm=cc'>)} {(SQ <'\n'> <'\ttest_confirm --confirm=cc\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--confirm=compose'>)} {(SQ <'\n'> <'\ttest_confirm --confirm=compose --compose\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'confirm by default (due to cc)'>)} { (SQ <'\n'> <'\ttest_when_finished git config sendemail.confirm never &&\n'> <'\tgit config --unset sendemail.confirm &&\n'> <'\ttest_confirm\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'confirm by default (due to --compose)'>)} { (SQ <'\n'> <'\ttest_when_finished git config sendemail.confirm never &&\n'> <'\tgit config --unset sendemail.confirm &&\n'> <'\ttest_confirm --suppress-cc=all --compose\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'confirm detects EOF (inform assumes y)'>)} { (SQ <'\n'> <'\ttest_when_finished git config sendemail.confirm never &&\n'> <'\tgit config --unset sendemail.confirm &&\n'> <'\trm -fr outdir &&\n'> <'\tgit format-patch -2 -o outdir &&\n'> <'\tGIT_SEND_EMAIL_NOTTY=1 \\\n'> <'\t\tgit send-email \\\n'> <'\t\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t\t--to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\toutdir/*.patch </dev/null\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'confirm detects EOF (auto causes failure)'>)} { (SQ <'\n'> <'\ttest_when_finished git config sendemail.confirm never &&\n'> <'\tgit config sendemail.confirm auto &&\n'> <'\tGIT_SEND_EMAIL_NOTTY=1 &&\n'> <'\texport GIT_SEND_EMAIL_NOTTY &&\n'> <'\t\ttest_must_fail git send-email \\\n'> <'\t\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t\t--to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\t$patches </dev/null\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'confirm does not loop forever'>)} { (SQ <'\n'> <'\ttest_when_finished git config sendemail.confirm never &&\n'> <'\tgit config sendemail.confirm auto &&\n'> <'\tGIT_SEND_EMAIL_NOTTY=1 &&\n'> <'\texport GIT_SEND_EMAIL_NOTTY &&\n'> <'\t\tyes "bogus" | test_must_fail git send-email \\\n'> <'\t\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t\t--to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\t$patches\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'utf8 Cc is rfc2047 encoded'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\trm -fr outdir &&\n'> < '\tgit format-patch -1 -o outdir --cc="\xc3\xa0\xc3\xa9\xc3\xac\xc3\xb6\xc3\xba <utf8@example.com>" &&\n' > <'\tgit send-email \\\n'> <'\t--from="Example <nobody@example.com>" \\\n'> <'\t--to=nobody@example.com \\\n'> <'\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\toutdir/*.patch &&\n'> <'\tgrep "^\t" msgtxt1 |\n'> <'\tgrep "=?UTF-8?q?=C3=A0=C3=A9=C3=AC=C3=B6=C3=BA?= <utf8@example.com>"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose adds MIME for utf8 body'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\twrite_script fake-editor-utf8 <<-\\EOF &&\n'> <'\techo "utf8 body: \xc3\xa0\xc3\xa9\xc3\xac\xc3\xb6\xc3\xba" >>"$1"\n'> <'\tEOF\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor-utf8\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose --subject foo \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^utf8 body" msgtxt1 &&\n'> <'\tgrep "^Content-Type: text/plain; charset=UTF-8" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose respects user mime type'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\twrite_script fake-editor-utf8-mime <<-\\EOF &&\n'> <'\tcat >"$1" <<-\\EOM\n'> <'\tMIME-Version: 1.0\n'> <'\tContent-Type: text/plain; charset=iso-8859-1\n'> <'\tContent-Transfer-Encoding: 8bit\n'> <'\tSubject: foo\n'> <'\n'> <'\tutf8 body: \xc3\xa0\xc3\xa9\xc3\xac\xc3\xb6\xc3\xba\n'> <'\tEOM\n'> <'\tEOF\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor-utf8-mime\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose --subject foo \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^utf8 body" msgtxt1 &&\n'> <'\tgrep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1 &&\n'> <'\t! grep "^Content-Type: text/plain; charset=UTF-8" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose adds MIME for utf8 subject'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose --subject utf8-s\xc3\xbcbj\xc3\xabct \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^fake edit" msgtxt1 &&\n'> <'\tgrep "^Subject: =?UTF-8?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'utf8 author is correctly passed on'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\ttest_commit weird_author &&\n'> <'\ttest_when_finished "git reset --hard HEAD^" &&\n'> < '\tgit commit --amend --author "F\xc3\xbc\xc3\xb1n\xc3\xbd N\xc3\xa2m\xc3\xa9 <odd_?=mail@example.com>" &&\n' > <'\tgit format-patch --stdout -1 >funny_name.patch &&\n'> <'\tgit send-email --from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\tfunny_name.patch &&\n'> <'\tgrep "^From: F\xc3\xbc\xc3\xb1n\xc3\xbd N\xc3\xa2m\xc3\xa9 <odd_?=mail@example.com>" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'utf8 sender is not duplicated'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\ttest_commit weird_sender &&\n'> <'\ttest_when_finished "git reset --hard HEAD^" &&\n'> < '\tgit commit --amend --author "F\xc3\xbc\xc3\xb1n\xc3\xbd N\xc3\xa2m\xc3\xa9 <odd_?=mail@example.com>" &&\n' > <'\tgit format-patch --stdout -1 >funny_name.patch &&\n'> < '\tgit send-email --from="F\xc3\xbc\xc3\xb1n\xc3\xbd N\xc3\xa2m\xc3\xa9 <odd_?=mail@example.com>" \\\n' > <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\tfunny_name.patch &&\n'> <'\tgrep "^From: " msgtxt1 >msgfrom &&\n'> <'\ttest_line_count = 1 msgfrom\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.composeencoding works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit config sendemail.composeencoding iso-8859-1 &&\n'> <'\twrite_script fake-editor-utf8 <<-\\EOF &&\n'> <'\techo "utf8 body: \xc3\xa0\xc3\xa9\xc3\xac\xc3\xb6\xc3\xba" >>"$1"\n'> <'\tEOF\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor-utf8\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose --subject foo \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^utf8 body" msgtxt1 &&\n'> <'\tgrep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose-encoding works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\twrite_script fake-editor-utf8 <<-\\EOF &&\n'> <'\techo "utf8 body: \xc3\xa0\xc3\xa9\xc3\xac\xc3\xb6\xc3\xba" >>"$1"\n'> <'\tEOF\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor-utf8\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose-encoding iso-8859-1 \\\n'> <'\t\t--compose --subject foo \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^utf8 body" msgtxt1 &&\n'> <'\tgrep "^Content-Type: text/plain; charset=iso-8859-1" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose-encoding overrides sendemail.composeencoding'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit config sendemail.composeencoding iso-8859-1 &&\n'> <'\twrite_script fake-editor-utf8 <<-\\EOF &&\n'> <'\techo "utf8 body: \xc3\xa0\xc3\xa9\xc3\xac\xc3\xb6\xc3\xba" >>"$1"\n'> <'\tEOF\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor-utf8\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose-encoding iso-8859-2 \\\n'> <'\t\t--compose --subject foo \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^utf8 body" msgtxt1 &&\n'> <'\tgrep "^Content-Type: text/plain; charset=iso-8859-2" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--compose-encoding adds correct MIME for subject'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tGIT_EDITOR="\\"$(pwd)/fake-editor\\"" \\\n'> <'\tgit send-email \\\n'> <'\t\t--compose-encoding iso-8859-2 \\\n'> <'\t\t--compose --subject utf8-s\xc3\xbcbj\xc3\xabct \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t$patches &&\n'> <'\tgrep "^fake edit" msgtxt1 &&\n'> <'\tgrep "^Subject: =?iso-8859-2?q?utf8-s=C3=BCbj=C3=ABct?=" msgtxt1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'detects ambiguous reference/file conflict'>)} { (SQ <'\n'> <'\techo master >master &&\n'> <'\tgit add master &&\n'> <'\tgit commit -m"add master" &&\n'> <'\ttest_must_fail git send-email --dry-run master 2>errors &&\n'> <'\tgrep disambiguate errors\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'feed two files'>)} { (SQ <'\n'> <'\trm -fr outdir &&\n'> <'\tgit format-patch -2 -o outdir &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\toutdir/000?-*.patch 2>errors >out &&\n'> <'\tgrep "^Subject: " out >subjects &&\n'> <'\ttest "z$(sed -n -e 1p subjects)" = "zSubject: [PATCH 1/2] Second." &&\n'> <'\ttest "z$(sed -n -e 2p subjects)" = "zSubject: [PATCH 2/2] add master"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'in-reply-to but no threading'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--in-reply-to="<in-reply-id@example.com>" \\\n'> <'\t\t--no-thread \\\n'> <'\t\t$patches |\n'> <'\tgrep "In-Reply-To: <in-reply-id@example.com>"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'no in-reply-to and no threading'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--no-thread \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\t! grep "In-Reply-To: " stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'threading but no chain-reply-to'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--thread \\\n'> <'\t\t--no-chain-reply-to \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "In-Reply-To: " stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.to works'>)} { (SQ <'\n'> <'\tgit config --replace-all sendemail.to "Somebody <somebody@ex.com>" &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "To: Somebody <somebody@ex.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--no-to overrides sendemail.to'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--no-to \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "To: nobody@example.com" stdout &&\n'> <'\t! grep "To: Somebody <somebody@ex.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.cc works'>)} { (SQ <'\n'> <'\tgit config --replace-all sendemail.cc "Somebody <somebody@ex.com>" &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "Cc: Somebody <somebody@ex.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--no-cc overrides sendemail.cc'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--no-cc \\\n'> <'\t\t--cc=bodies@example.com \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "Cc: bodies@example.com" stdout &&\n'> <'\t! grep "Cc: Somebody <somebody@ex.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.bcc works'>)} { (SQ <'\n'> <'\tgit config --replace-all sendemail.bcc "Other <other@ex.com>" &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server relay.example.com \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "RCPT TO:<other@ex.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--no-bcc overrides sendemail.bcc'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--no-bcc \\\n'> <'\t\t--bcc=bodies@example.com \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server relay.example.com \\\n'> <'\t\t$patches $patches >stdout &&\n'> <'\tgrep "RCPT TO:<bodies@example.com>" stdout &&\n'> <'\t! grep "RCPT TO:<other@ex.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'patches To headers are used by default'>)} { (SQ <'\n'> <'\tpatch=$(git format-patch -1 --to="bodies@example.com") &&\n'> <'\ttest_when_finished "rm $patch" &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--smtp-server relay.example.com \\\n'> <'\t\t$patch >stdout &&\n'> <'\tgrep "RCPT TO:<bodies@example.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'patches To headers are appended to'>)} { (SQ <'\n'> <'\tpatch=$(git format-patch -1 --to="bodies@example.com") &&\n'> <'\ttest_when_finished "rm $patch" &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server relay.example.com \\\n'> <'\t\t$patch >stdout &&\n'> <'\tgrep "RCPT TO:<bodies@example.com>" stdout &&\n'> <'\tgrep "RCPT TO:<nobody@example.com>" stdout\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'To headers from files reset each patch'>)} { (SQ <'\n'> <'\tpatch1=$(git format-patch -1 --to="bodies@example.com") &&\n'> <'\tpatch2=$(git format-patch -1 --to="other@example.com" HEAD~) &&\n'> <'\ttest_when_finished "rm $patch1 && rm $patch2" &&\n'> <'\tgit send-email \\\n'> <'\t\t--dry-run \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to="nobody@example.com" \\\n'> <'\t\t--smtp-server relay.example.com \\\n'> <'\t\t$patch1 $patch2 >stdout &&\n'> <'\ttest $(grep -c "RCPT TO:<bodies@example.com>" stdout) = 1 &&\n'> <'\ttest $(grep -c "RCPT TO:<nobody@example.com>" stdout) = 2 &&\n'> <'\ttest $(grep -c "RCPT TO:<other@example.com>" stdout) = 1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'cat >email-using-8bit <<\\EOF\n'> <'From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001\n'> <'Message-Id: <bogus-message-id@example.com>\n'> <'From: author@example.com\n'> <'Date: Sat, 12 Jun 2010 15:53:58 +0200\n'> <'Subject: subject goes here\n'> <'\n'> <'Dieser deutsche Text enth\xc3\xa4lt einen Umlaut!\n'> <'EOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} {(SQ <'\n'> <'\techo "Subject: subject goes here" >expected\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'ASCII subject is not RFC2047 quoted'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo bogus |\n'> <'\tgit send-email --from=author@example.com --to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\t--8bit-encoding=UTF-8 \\\n'> <'\t\t\temail-using-8bit >stdout &&\n'> <'\tgrep "Subject" msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >content-type-decl <<-\\EOF\n'> <'\tMIME-Version: 1.0\n'> <'\tContent-Type: text/plain; charset=UTF-8\n'> <'\tContent-Transfer-Encoding: 8bit\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'asks about and fixes 8bit encodings'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo |\n'> <'\tgit send-email --from=author@example.com --to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\temail-using-8bit >stdout &&\n'> <'\tgrep "do not declare a Content-Transfer-Encoding" stdout &&\n'> <'\tgrep email-using-8bit stdout &&\n'> <'\tgrep "Which 8bit encoding" stdout &&\n'> <'\tegrep "Content|MIME" msgtxt1 >actual &&\n'> <'\ttest_cmp actual content-type-decl\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.8bitEncoding works'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit config sendemail.assume8bitEncoding UTF-8 &&\n'> <'\techo bogus |\n'> <'\tgit send-email --from=author@example.com --to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\temail-using-8bit >stdout &&\n'> <'\tegrep "Content|MIME" msgtxt1 >actual &&\n'> <'\ttest_cmp actual content-type-decl\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--8bit-encoding overrides sendemail.8bitEncoding'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit config sendemail.assume8bitEncoding "bogus too" &&\n'> <'\techo bogus |\n'> <'\tgit send-email --from=author@example.com --to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\t--8bit-encoding=UTF-8 \\\n'> <'\t\t\temail-using-8bit >stdout &&\n'> <'\tegrep "Content|MIME" msgtxt1 >actual &&\n'> <'\ttest_cmp actual content-type-decl\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >email-using-8bit <<-\\EOF\n'> <'\tFrom fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001\n'> <'\tMessage-Id: <bogus-message-id@example.com>\n'> <'\tFrom: author@example.com\n'> <'\tDate: Sat, 12 Jun 2010 15:53:58 +0200\n'> <'\tSubject: Dieser Betreff enth\xc3\xa4lt auch einen Umlaut!\n'> <'\n'> <'\tNothing to see here.\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\tSubject: =?UTF-8?q?Dieser=20Betreff=20enth=C3=A4lt=20auch=20einen=20Umlaut!?=\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--8bit-encoding also treats subject'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo bogus |\n'> <'\tgit send-email --from=author@example.com --to=nobody@example.com \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\t--8bit-encoding=UTF-8 \\\n'> <'\t\t\temail-using-8bit >stdout &&\n'> <'\tgrep "Subject" msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >email-using-8bit <<-\\EOF\n'> <'\tFrom fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001\n'> <'\tMessage-Id: <bogus-message-id@example.com>\n'> <'\tFrom: A U Thor <author@example.com>\n'> <'\tDate: Sat, 12 Jun 2010 15:53:58 +0200\n'> <'\tContent-Type: text/plain; charset=UTF-8\n'> <'\tSubject: Nothing to see here.\n'> <'\n'> <'\tDieser Betreff enth\xc3\xa4lt auch einen Umlaut!\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.transferencoding=7bit fails on 8bit data'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit config sendemail.transferEncoding 7bit &&\n'> <'\ttest_must_fail git send-email \\\n'> <'\t\t--transfer-encoding=7bit \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-8bit \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "cannot send message as 7bit" errors &&\n'> <'\ttest -z "$(ls msgtxt*)"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--transfer-encoding overrides sendemail.transferEncoding'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit config sendemail.transferEncoding 8bit &&\n'> <'\ttest_must_fail git send-email \\\n'> <'\t\t--transfer-encoding=7bit \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-8bit \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "cannot send message as 7bit" errors &&\n'> <'\ttest -z "$(ls msgtxt*)"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.transferencoding=8bit'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--transfer-encoding=8bit \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-8bit \\\n'> <'\t\t2>errors >out &&\n'> <'\tsed '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' msgtxt1 >actual &&\n'> <'\tsed '>) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' email-using-8bit >expected &&\n'> <'\ttest_cmp expected actual\n'>) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\tDieser Betreff enth=C3=A4lt auch einen Umlaut!\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'8-bit and sendemail.transferencoding=quoted-printable'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--transfer-encoding=quoted-printable \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-8bit \\\n'> <'\t\t2>errors >out &&\n'> <'\tsed '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'>) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\tRGllc2VyIEJldHJlZmYgZW50aMOkbHQgYXVjaCBlaW5lbiBVbWxhdXQhCg==\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'8-bit and sendemail.transferencoding=base64'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--transfer-encoding=base64 \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-8bit \\\n'> <'\t\t2>errors >out &&\n'> <'\tsed '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'>) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >email-using-qp <<-\\EOF\n'> <'\tFrom fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001\n'> <'\tMessage-Id: <bogus-message-id@example.com>\n'> <'\tFrom: A U Thor <author@example.com>\n'> <'\tDate: Sat, 12 Jun 2010 15:53:58 +0200\n'> <'\tMIME-Version: 1.0\n'> <'\tContent-Transfer-Encoding: quoted-printable\n'> <'\tContent-Type: text/plain; charset=UTF-8\n'> <'\tSubject: Nothing to see here.\n'> <'\n'> <'\tDieser Betreff enth=C3=A4lt auch einen Umlaut!\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'convert from quoted-printable to base64'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--transfer-encoding=base64 \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-qp \\\n'> <'\t\t2>errors >out &&\n'> <'\tsed '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'>) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (DQ ('\n') ("tr -d '") (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ("015' | tr '%' '") (EscapedLiteralPart token:<Lit_EscapedChar '\\\\'>) ("015' >email-using-crlf <<EOF\n") ('From fe6ecc66ece37198fe5db91fa2fc41d9f4fe5cc4 Mon Sep 17 00:00:00 2001\n') ('Message-Id: <bogus-message-id@example.com>\n') ('From: A U Thor <author@example.com>\n') ('Date: Sat, 12 Jun 2010 15:53:58 +0200\n') ('Content-Type: text/plain; charset=UTF-8\n') ('Subject: Nothing to see here.\n') ('\n') ('Look, I have a CRLF and an = sign!%\n') ('EOF\n') ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\tLook, I have a CRLF and an =3D sign!=0D\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'CRLF and sendemail.transferencoding=quoted-printable'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--transfer-encoding=quoted-printable \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-crlf \\\n'> <'\t\t2>errors >out &&\n'> <'\tsed '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'>) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expect'>)} { (SQ <'\n'> <'\tcat >expected <<-\\EOF\n'> <'\tTG9vaywgSSBoYXZlIGEgQ1JMRiBhbmQgYW4gPSBzaWduIQ0K\n'> <'\tEOF\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'CRLF and sendemail.transferencoding=base64'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\tgit send-email \\\n'> <'\t\t--transfer-encoding=base64 \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\temail-using-crlf \\\n'> <'\t\t2>errors >out &&\n'> <'\tsed '> ) (1) (Lit_Comma ',') (/) (Lit_Other '^') (Lit_Other '$') (/d) (SQ <' msgtxt1 >actual &&\n'> <'\ttest_cmp expected actual\n'>) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'refusing to send cover letter template'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\trm -fr outdir &&\n'> <'\tgit format-patch --cover-letter -2 -o outdir &&\n'> <'\ttest_must_fail git send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\toutdir/0002-*.patch \\\n'> <'\t\toutdir/0000-*.patch \\\n'> <'\t\toutdir/0001-*.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "SUBJECT HERE" errors &&\n'> <'\ttest -z "$(ls msgtxt*)"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--force sends cover letter template anyway'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\trm -fr outdir &&\n'> <'\tgit format-patch --cover-letter -2 -o outdir &&\n'> <'\tgit send-email \\\n'> <'\t\t--force \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=nobody@example.com \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\toutdir/0002-*.patch \\\n'> <'\t\toutdir/0000-*.patch \\\n'> <'\t\toutdir/0001-*.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\t! grep "SUBJECT HERE" errors &&\n'> <'\ttest -n "$(ls msgtxt*)"\n'> ) } ) (FuncDef name: test_cover_addresses body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:header) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [3499] ) ] spids: [3499] ) (C {(shift)}) (AndOr ops: [ Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp ] children: [ (C {(clean_fake_sendmail)}) (C {(rm)} {(-fr)} {(outdir)}) (C {(git)} {(format-patch)} {(--cover-letter)} {(-2)} {(-o)} {(outdir)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cover) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(echo)} {(outdir/0000-) (Lit_Other '*') (.patch)})] ) left_token: <Left_CommandSub '$('> spids: [3538 3544] ) } spids: [3537] ) ] spids: [3537] ) (C {(mv)} {($ VSub_Name '$cover')} {(cover-to-edit.patch)}) (SimpleCommand words: [ {(perl)} {(-pe)} { (DQ ('s/^From:/') ($ VSub_Name '$header') (': extra') (Lit_Other '\\') ('@address.com') (Lit_Other '\\') ('nFrom:/') ) } {(cover-to-edit.patch)} ] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ ($ VSub_Name '$cover'))} spids: [3574] ) ] ) (SimpleCommand words: [ {(git)} {(send-email)} {(--force)} {(--from) (Lit_Other '=') (DQ ('Example <nobody@example.com>'))} {(--no-to)} {(--no-cc)} {(DQ ($ VSub_At '$@'))} {(--smtp-server) (Lit_Other '=') (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [3615 3617] ) (/fake.sendmail) ) } {(outdir/0000-) (Lit_Other '*') (.patch)} {(outdir/0001-) (Lit_Other '*') (.patch)} {(outdir/0002-) (Lit_Other '*') (.patch)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(errors)} spids: [3641] ) (Redir op_id: Redir_Great fd: 16777215 arg_word: {(out)} spids: [3644] ) ] ) (SimpleCommand words: [ {(grep)} {(DQ ('^') ($ VSub_Name '$header') (': extra@address.com'))} {(msgtxt1)} ] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(to1)} spids:[3660])] ) (SimpleCommand words: [ {(grep)} {(DQ ('^') ($ VSub_Name '$header') (': extra@address.com'))} {(msgtxt2)} ] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(to2)} spids:[3676])] ) (SimpleCommand words: [ {(grep)} {(DQ ('^') ($ VSub_Name '$header') (': extra@address.com'))} {(msgtxt3)} ] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(to3)} spids:[3692])] ) (C {(test_line_count)} {(Lit_Other '=')} {(1)} {(to1)}) (C {(test_line_count)} {(Lit_Other '=')} {(1)} {(to2)}) (C {(test_line_count)} {(Lit_Other '=')} {(1)} {(to3)}) ] ) ] spids: [3496] ) spids: [3491 3495] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'to-cover adds To to all mail'>)} {(SQ <'\n'> <'\ttest_cover_addresses "To" --to-cover\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'cc-cover adds Cc to all mail'>)} {(SQ <'\n'> <'\ttest_cover_addresses "Cc" --cc-cover\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'tocover adds To to all mail'>)} {(SQ <'\n'> <'\ttest_config sendemail.tocover true &&\n'> <'\ttest_cover_addresses "To"\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'cccover adds Cc to all mail'>)} {(SQ <'\n'> <'\ttest_config sendemail.cccover true &&\n'> <'\ttest_cover_addresses "Cc"\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'escaped quotes in sendemail.aliasfiletype=mutt'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd \\\\\\"Dot U. Sir\\\\\\" <somebody@example.org>" >.mutt &&\n'> <'\tgit config --replace-all sendemail.aliasesfile "$(pwd)/.mutt" &&\n'> <'\tgit config sendemail.aliasfiletype mutt &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=sbd \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\toutdir/0001-*.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!somebody@example\\.org!$" commandline1 &&\n'> <'\tgrep -F "To: \\"Dot U. Sir\\" <somebody@example.org>" out\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.aliasfiletype=mailrc'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd somebody@example.org" >.mailrc &&\n'> <'\tgit config --replace-all sendemail.aliasesfile "$(pwd)/.mailrc" &&\n'> <'\tgit config sendemail.aliasfiletype mailrc &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=sbd \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\toutdir/0001-*.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!somebody@example\\.org!$" commandline1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'sendemail.aliasfile=~/.mailrc'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd someone@example.org" >"$HOME/.mailrc" &&\n'> <'\tgit config --replace-all sendemail.aliasesfile "~/.mailrc" &&\n'> <'\tgit config sendemail.aliasfiletype mailrc &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to=sbd \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\toutdir/0001-*.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!someone@example\\.org!$" commandline1\n'> ) } ) (FuncDef name: test_dump_aliases body: (BraceGroup children: [ (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:msg) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [3870] ) ] spids: [3870] ) (C {(shift)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:filetype) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [3882] ) ] spids: [3882] ) (C {(shift)}) (SimpleCommand words: [{(printf)} {(SQ <'%s\\n'>)} {(DQ ($ VSub_At '$@'))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(expect)} spids:[3904])] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(.tmp-email-aliases)} spids: [3912] ) ] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(DQ ($ VSub_Name '$msg'))} { (SQ <'\n'> <'\t\tclean_fake_sendmail && rm -fr outdir &&\n'> <'\t\tgit config --replace-all sendemail.aliasesfile \\\n'> <'\t\t\t"$(pwd)/.tmp-email-aliases" &&\n'> <'\t\tgit config sendemail.aliasfiletype "$filetype" &&\n'> <'\t\tgit send-email --dump-aliases 2>errors >actual &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t'> ) } ) ] ) ] spids: [3867] ) spids: [3862 3866] ) (SimpleCommand words: [ {(test_dump_aliases)} {(SQ <'--dump-aliases sendmail format'>)} {(SQ <sendmail>)} {(SQ <abgroup>)} {(SQ <alice>)} {(SQ <bcgrp>)} {(SQ <bob>)} {(SQ <chloe>)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('alice: Alice W Land <awol@example.com>\n') ('bob: Robert Bobbyton <bob@example.com>\n') ('chloe: chloe@example.com\n') ('abgroup: alice, bob\n') ('bcgrp: bob, chloe, Other <o@example.com>\n') } do_expansion: False here_end: EOF was_filled: T spids: [3983] ) ] ) (SimpleCommand words: [ {(test_dump_aliases)} {(SQ <'--dump-aliases mutt format'>)} {(SQ <mutt>)} {(SQ <alice>)} {(SQ <bob>)} {(SQ <chloe>)} {(SQ <donald>)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('alias alice Alice W Land <awol@example.com>\n') ('alias donald Donald C Carlton <donc@example.com>\n') ('alias bob Robert Bobbyton <bob@example.com>\n') ('alias chloe chloe@example.com\n') } do_expansion: False here_end: EOF was_filled: T spids: [4024] ) ] ) (SimpleCommand words: [ {(test_dump_aliases)} {(SQ <'--dump-aliases mailrc format'>)} {(SQ <mailrc>)} {(SQ <alice>)} {(SQ <bob>)} {(SQ <chloe>)} {(SQ <eve>)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('alias alice Alice W Land <awol@example.com>\n') ('alias eve Eve <eve@example.com>\n') ('alias bob Robert Bobbyton <bob@example.com>\n') ('alias chloe chloe@example.com\n') } do_expansion: False here_end: EOF was_filled: T spids: [4065] ) ] ) (SimpleCommand words: [ {(test_dump_aliases)} {(SQ <'--dump-aliases pine format'>)} {(SQ <pine>)} {(SQ <alice>)} {(SQ <bob>)} {(SQ <chloe>)} {(SQ <eve>)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('alice\tAlice W Land\t<awol@example.com>\n') ('eve\tEve\t<eve@example.com>\n') ('bob\tRobert\tBobbyton <bob@example.com>\n') ('chloe\t\tchloe@example.com\n') } do_expansion: False here_end: EOF was_filled: T spids: [4106] ) ] ) (SimpleCommand words: [ {(test_dump_aliases)} {(SQ <'--dump-aliases gnus format'>)} {(SQ <gnus>)} {(SQ <alice>)} {(SQ <bob>)} {(SQ <chloe>)} {(SQ <eve>)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('(define-mail-alias "alice" "awol@example.com")\n') ('(define-mail-alias "eve" "eve@example.com")\n') ('(define-mail-alias "bob" "bob@example.com")\n') ('(define-mail-alias "chloe" "chloe@example.com")\n') } do_expansion: False here_end: EOF was_filled: T spids: [4147] ) ] ) (C {(test_expect_success)} {(SQ <'--dump-aliases must be used alone'>)} { (SQ <'\n'> < '\ttest_must_fail git send-email --dump-aliases --to=janice@example.com -1 refs/heads/accounting\n' > ) } ) (FuncDef name: test_sendmail_aliases body: (BraceGroup children: [ (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:msg) op: Equal rhs: {(DQ ($ VSub_Number '$1'))} spids: [4172] ) ] spids: [4172] ) (C {(shift)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:expect) op: Equal rhs: {(DQ ($ VSub_At '$@'))} spids: [4184] ) ] spids: [4184] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(.tmp-email-aliases)} spids: [4194] ) ] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(DQ ($ VSub_Name '$msg'))} { (SQ <'\n'> <'\t\tclean_fake_sendmail && rm -fr outdir &&\n'> <'\t\tgit format-patch -1 -o outdir &&\n'> <'\t\tgit config --replace-all sendemail.aliasesfile \\\n'> <'\t\t\t"$(pwd)/.tmp-email-aliases" &&\n'> <'\t\tgit config sendemail.aliasfiletype sendmail &&\n'> <'\t\tgit send-email \\\n'> <'\t\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t\t--to=alice --to=bcgrp \\\n'> <'\t\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\t\toutdir/0001-*.patch \\\n'> <'\t\t\t2>errors >out &&\n'> <'\t\tfor i in $expect\n'> <'\t\tdo\n'> <'\t\t\tgrep "^!$i!$" commandline1 || return 1\n'> <'\t\tdone\n'> <'\t'> ) } ) ] ) ] spids: [4169] ) spids: [4164 4168] ) (SimpleCommand words: [ {(test_sendmail_aliases)} {(SQ <'sendemail.aliasfiletype=sendmail'>)} {(SQ <'awol@example\\.com'>)} {(SQ <'bob@example\\.com'>)} {(SQ <'chloe@example\\.com'>)} {(SQ <'o@example\\.com'>)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('alice: Alice W Land <awol@example.com>\n') ('bob: Robert Bobbyton <bob@example.com>\n') ('# this is a comment\n') (' # this is also a comment\n') ('chloe: chloe@example.com\n') ('abgroup: alice, bob\n') ('bcgrp: bob, chloe, Other <o@example.com>\n') } do_expansion: False here_end: EOF was_filled: T spids: [4262] ) ] ) (SimpleCommand words: [ {(test_sendmail_aliases)} {(SQ <'sendmail aliases line folding'>)} {(alice1)} {(bob1)} {(bob2)} {(chuck1)} {(chuck2)} {(darla1)} {(darla2)} {(darla3)} {(elton1)} {(elton2)} {(elton3)} {(fred1)} {(fred2)} {(greg1)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {('alice: alice1\n') ('bob: bob1,\\\n') ('bob2\n') ('chuck: chuck1,\n') (' chuck2\n') ('darla: darla1,\\\n') ('darla2,\n') (' darla3\n') ('elton: elton1,\n') (' elton2,\\\n') ('elton3\n') ('fred: fred1,\\\n') (' fred2\n') ('greg: greg1\n') ('bcgrp: bob, chuck, darla, elton, fred, greg\n') } do_expansion: False here_end: EOF was_filled: T spids: [4315] ) ] ) (SimpleCommand words: [ {(test_sendmail_aliases)} {(SQ <'sendmail aliases tolerate bogus line folding'>)} {(alice1)} {(bob1)} ] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {(' alice: alice1\n') ('bcgrp: bob1\\\n')} do_expansion: False here_end: EOF was_filled: T spids: [4332] ) ] ) (SimpleCommand words: [{(test_sendmail_aliases)} {(SQ <'sendmail aliases empty'>)} {(alice)} {(bcgrp)}] redirects: [ (HereDoc op_id: Redir_DLessDash fd: 16777215 body: {} do_expansion: False here_end: EOF was_filled: T spids: [4347] ) ] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'alias support in To header'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd someone@example.org" >.mailrc &&\n'> <'\ttest_config sendemail.aliasesfile ".mailrc" &&\n'> <'\ttest_config sendemail.aliasfiletype mailrc &&\n'> <'\tgit format-patch --stdout -1 --to=sbd >aliased.patch &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\taliased.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!someone@example\\.org!$" commandline1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'alias support in Cc header'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd someone@example.org" >.mailrc &&\n'> <'\ttest_config sendemail.aliasesfile ".mailrc" &&\n'> <'\ttest_config sendemail.aliasfiletype mailrc &&\n'> <'\tgit format-patch --stdout -1 --cc=sbd >aliased.patch &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\taliased.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!someone@example\\.org!$" commandline1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'tocmd works with aliases'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd someone@example.org" >.mailrc &&\n'> <'\ttest_config sendemail.aliasesfile ".mailrc" &&\n'> <'\ttest_config sendemail.aliasfiletype mailrc &&\n'> <'\tgit format-patch --stdout -1 >tocmd.patch &&\n'> <'\techo tocmd--sbd >>tocmd.patch &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--to-cmd=./tocmd-sed \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\ttocmd.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!someone@example\\.org!$" commandline1\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'cccmd works with aliases'>)} { (SQ <'\n'> <'\tclean_fake_sendmail &&\n'> <'\techo "alias sbd someone@example.org" >.mailrc &&\n'> <'\ttest_config sendemail.aliasesfile ".mailrc" &&\n'> <'\ttest_config sendemail.aliasfiletype mailrc &&\n'> <'\tgit format-patch --stdout -1 >cccmd.patch &&\n'> <'\techo cccmd--sbd >>cccmd.patch &&\n'> <'\tgit send-email \\\n'> <'\t\t--from="Example <nobody@example.com>" \\\n'> <'\t\t--cc-cmd=./cccmd-sed \\\n'> <'\t\t--smtp-server="$(pwd)/fake.sendmail" \\\n'> <'\t\tcccmd.patch \\\n'> <'\t\t2>errors >out &&\n'> <'\tgrep "^!someone@example\\.org!$" commandline1\n'> ) } ) (FuncDef name: do_xmailer_test body: (BraceGroup children: [ (AndOr ops: [Op_DAmp Op_DAmp Op_DAmp Op_DAmp] children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:expected) op: Equal rhs: {($ VSub_Number '$1')} spids: [4460] ) (assign_pair lhs: (LhsName name:params) op: Equal rhs: {($ VSub_Number '$2')} spids: [4463] ) ] spids: [4460] ) (C {(git)} {(format-patch)} {(-1)}) (SimpleCommand words: [ {(git)} {(send-email)} {(--from) (Lit_Other '=') (DQ ('Example <nobody@example.com>'))} {(--to) (Lit_Other '=') (someone) (Lit_Other '@') (example.com)} {(--smtp-server) (Lit_Other '=') (DQ (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [4503 4505] ) (/fake.sendmail) ) } {($ VSub_Name '$params')} {(0001-) (Lit_Other '*') (.patch)} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(errors)} spids: [4521] ) (Redir op_id: Redir_Great fd: 16777215 arg_word: {(out)} spids: [4524] ) ] ) (BraceGroup children: [ (Sentence child: (AndOr ops: [Op_DPipe] children: [(C {(grep)} {(SQ <'^X-Mailer:'>)} {(out)}) (C {(Lit_Other ':')})] ) terminator: <Op_Semi ';'> ) ] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(mailer)} spids:[4547])] spids: [4530] ) (C {(test_line_count)} {(Lit_Other '=')} {($ VSub_Name '$expected')} {(mailer)}) ] ) ] spids: [4457] ) spids: [4452 4456] ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--[no-]xmailer without any configuration'>)} {(SQ <'\n'> <'\tdo_xmailer_test 1 "--xmailer" &&\n'> <'\tdo_xmailer_test 0 "--no-xmailer"\n'>)} ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--[no-]xmailer with sendemail.xmailer=true'>)} { (SQ <'\n'> <'\ttest_config sendemail.xmailer true &&\n'> <'\tdo_xmailer_test 1 "" &&\n'> <'\tdo_xmailer_test 0 "--no-xmailer" &&\n'> <'\tdo_xmailer_test 1 "--xmailer"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'--[no-]xmailer with sendemail.xmailer=false'>)} { (SQ <'\n'> <'\ttest_config sendemail.xmailer false &&\n'> <'\tdo_xmailer_test 0 "" &&\n'> <'\tdo_xmailer_test 0 "--no-xmailer" &&\n'> <'\tdo_xmailer_test 1 "--xmailer"\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'setup expected-list'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t--dry-run \\\n'> <'\t--from="Example <from@example.com>" \\\n'> <'\t--to="To 1 <to1@example.com>" \\\n'> <'\t--to="to2@example.com" \\\n'> <'\t--to="to3@example.com" \\\n'> <'\t--cc="Cc 1 <cc1@example.com>" \\\n'> <'\t--cc="Cc2 <cc2@example.com>" \\\n'> <'\t--bcc="bcc1@example.com" \\\n'> <'\t--bcc="bcc2@example.com" \\\n'> <'\t0001-add-master.patch | replace_variable_fields \\\n'> <'\t>expected-list\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'use email list in --cc --to and --bcc'>)} { (SQ <'\n'> <'\tgit send-email \\\n'> <'\t--dry-run \\\n'> <'\t--from="Example <from@example.com>" \\\n'> <'\t--to="To 1 <to1@example.com>, to2@example.com" \\\n'> <'\t--to="to3@example.com" \\\n'> <'\t--cc="Cc 1 <cc1@example.com>, Cc2 <cc2@example.com>" \\\n'> <'\t--bcc="bcc1@example.com, bcc2@example.com" \\\n'> <'\t0001-add-master.patch | replace_variable_fields \\\n'> <'\t>actual-list &&\n'> <'\ttest_cmp expected-list actual-list\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'aliases work with email list'>)} { (SQ <'\n'> <'\techo "alias to2 to2@example.com" >.mutt &&\n'> <'\techo "alias cc1 Cc 1 <cc1@example.com>" >>.mutt &&\n'> <'\ttest_config sendemail.aliasesfile ".mutt" &&\n'> <'\ttest_config sendemail.aliasfiletype mutt &&\n'> <'\tgit send-email \\\n'> <'\t--dry-run \\\n'> <'\t--from="Example <from@example.com>" \\\n'> <'\t--to="To 1 <to1@example.com>, to2, to3@example.com" \\\n'> <'\t--cc="cc1, Cc2 <cc2@example.com>" \\\n'> <'\t--bcc="bcc1@example.com, bcc2@example.com" \\\n'> <'\t0001-add-master.patch | replace_variable_fields \\\n'> <'\t>actual-list &&\n'> <'\ttest_cmp expected-list actual-list\n'> ) } ) (C {(test_expect_success)} {($ VSub_Name '$PREREQ')} {(SQ <'leading and trailing whitespaces are removed'>)} { (SQ <'\n'> <'\techo "alias to2 to2@example.com" >.mutt &&\n'> <'\techo "alias cc1 Cc 1 <cc1@example.com>" >>.mutt &&\n'> <'\ttest_config sendemail.aliasesfile ".mutt" &&\n'> <'\ttest_config sendemail.aliasfiletype mutt &&\n'> <'\tTO1=$(echo "QTo 1 <to1@example.com>" | q_to_tab) &&\n'> <'\tTO2=$(echo "QZto2" | qz_to_tab_space) &&\n'> <'\tCC1=$(echo "cc1" | append_cr) &&\n'> <'\tBCC1=$(echo "Q bcc1@example.com Q" | q_to_nul) &&\n'> <'\tgit send-email \\\n'> <'\t--dry-run \\\n'> <'\t--from="\tExample <from@example.com>" \\\n'> <'\t--to="$TO1" \\\n'> <'\t--to="$TO2" \\\n'> <'\t--to=" to3@example.com " \\\n'> <'\t--cc="$CC1" \\\n'> <'\t--cc="Cc2 <cc2@example.com>" \\\n'> <'\t--bcc="$BCC1" \\\n'> <'\t--bcc="bcc2@example.com" \\\n'> <'\t0001-add-master.patch | replace_variable_fields \\\n'> <'\t>actual-list &&\n'> <'\ttest_cmp expected-list actual-list\n'> ) } ) (C {(test_done)}) ] )