diff options
Diffstat (limited to 't/t5100-mailinfo.sh')
-rwxr-xr-x | t/t5100-mailinfo.sh | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index 9690dcad4f..141b29f031 100755 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@ -213,4 +213,59 @@ test_expect_failure 'mailinfo -b separated double [PATCH]' ' test z"$subj" = z"Subject: [other] message" ' +test_expect_success 'mailinfo handles unusual header whitespace' ' + git mailinfo /dev/null /dev/null >actual <<-\EOF && + From:Real Name <user@example.com> + Subject: extra spaces + EOF + + cat >expect <<-\EOF && + Author: Real Name + Email: user@example.com + Subject: extra spaces + + EOF + test_cmp expect actual +' + +check_quoted_cr_mail () { + mail="$1" && shift && + git mailinfo -u "$@" "$mail.msg" "$mail.patch" \ + <"$mail" >"$mail.info" 2>"$mail.err" && + test_cmp "$mail-expected.msg" "$mail.msg" && + test_cmp "$mail-expected.patch" "$mail.patch" && + test_cmp "$DATA/quoted-cr-info" "$mail.info" +} + +test_expect_success 'split base64 email with quoted-cr' ' + mkdir quoted-cr && + git mailsplit -oquoted-cr "$DATA/quoted-cr.mbox" >quoted-cr/last && + test $(cat quoted-cr/last) = 2 +' + +test_expect_success 'mailinfo warn CR in base64 encoded email' ' + sed -e "s/%%$//" -e "s/%%/$(printf \\015)/g" "$DATA/quoted-cr-msg" \ + >quoted-cr/0001-expected.msg && + sed "s/%%/$(printf \\015)/g" "$DATA/quoted-cr-msg" \ + >quoted-cr/0002-expected.msg && + sed -e "s/%%$//" -e "s/%%/$(printf \\015)/g" "$DATA/quoted-cr-patch" \ + >quoted-cr/0001-expected.patch && + sed "s/%%/$(printf \\015)/g" "$DATA/quoted-cr-patch" \ + >quoted-cr/0002-expected.patch && + check_quoted_cr_mail quoted-cr/0001 && + test_must_be_empty quoted-cr/0001.err && + check_quoted_cr_mail quoted-cr/0002 && + grep "quoted CRLF detected" quoted-cr/0002.err && + check_quoted_cr_mail quoted-cr/0001 --quoted-cr=nowarn && + test_must_be_empty quoted-cr/0001.err && + check_quoted_cr_mail quoted-cr/0002 --quoted-cr=nowarn && + test_must_be_empty quoted-cr/0002.err && + cp quoted-cr/0001-expected.msg quoted-cr/0002-expected.msg && + cp quoted-cr/0001-expected.patch quoted-cr/0002-expected.patch && + check_quoted_cr_mail quoted-cr/0001 --quoted-cr=strip && + test_must_be_empty quoted-cr/0001.err && + check_quoted_cr_mail quoted-cr/0002 --quoted-cr=strip && + test_must_be_empty quoted-cr/0002.err +' + test_done |