diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2023-05-01 16:38:48 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-05-01 17:55:52 +0200 |
commit | 3a7a18a045cd94a13ed04ef715dcd1b91547a0af (patch) | |
tree | 4feb6783d5fa37d05972f4037ed85cd5faf761cf /t/t9001-send-email.sh | |
parent | send-email: add --header-cmd, --no-header-cmd options (diff) | |
download | git-3a7a18a045cd94a13ed04ef715dcd1b91547a0af.tar.xz git-3a7a18a045cd94a13ed04ef715dcd1b91547a0af.zip |
send-email: detect empty blank lines in command output
The email format does not allow blank lines in headers; detect such
input and report it as malformed and add a test for it.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t9001-send-email.sh')
-rwxr-xr-x | t/t9001-send-email.sh | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index f10546acba..21d4f6a382 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -460,6 +460,23 @@ FoldedField: This is a tale grep "^FoldedField: This is a tale best told using multiple lines.$" msgtxt1 ' +# Blank lines in the middle of the output of a command are invalid. +test_expect_success $PREREQ 'malform output reported on blank lines in command output' ' + clean_fake_sendmail && + cp $patches headercmd.patch && + write_script headercmd-malformed-output <<-\EOF && + echo "X-Debbugs-CC: someone@example.com + +SomeOtherField: someone-else@example.com" + EOF + ! git send-email \ + --from="Example <nobody@example.com>" \ + --to=nobody@example.com \ + --header-cmd=./headercmd-malformed-output \ + --smtp-server="$(pwd)/fake.sendmail" \ + headercmd.patch +' + test_expect_success $PREREQ 'reject long lines' ' z8=zzzzzzzz && z64=$z8$z8$z8$z8$z8$z8$z8$z8 && |