1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-27 06:26:13 +02:00

Merge branch 'jc/send-email-pre-process-fix' into next

* jc/send-email-pre-process-fix:
  send-email: clear the $message_id after validation
This commit is contained in:
Junio C Hamano 2023-05-17 14:40:05 -07:00
commit fa1900a383
2 changed files with 17 additions and 1 deletions

View File

@ -1788,6 +1788,7 @@ sub pre_process_file {
$subject = $initial_subject;
$message = "";
$message_num++;
undef $message_id;
# Retrieve and unfold header fields.
my @header_lines = ();
while(<$fh>) {

View File

@ -47,7 +47,7 @@ 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) &&
threaded_patches=$(git format-patch -o threaded -s --in-reply-to="format" HEAD^1)
threaded_patches=$(git format-patch -o threaded --thread=shallow -s --in-reply-to="format" HEAD^1)
'
# Test no confirm early to ensure remaining tests will not hang
@ -655,6 +655,21 @@ test_expect_success $PREREQ "--validate hook supports header argument" '
outdir/000?-*.patch
'
test_expect_success $PREREQ 'clear message-id before parsing a new message' '
clean_fake_sendmail &&
echo true | write_script my-hooks/sendemail-validate &&
test_config core.hooksPath my-hooks &&
GIT_SEND_EMAIL_NOTTY=1 \
git send-email --validate --to=recipient@example.com \
--smtp-server="$(pwd)/fake.sendmail" \
$patches $threaded_patches &&
id0=$(grep "^Message-ID: " $threaded_patches) &&
id1=$(grep "^Message-ID: " msgtxt1) &&
id2=$(grep "^Message-ID: " msgtxt2) &&
test "z$id0" = "z$id2" &&
test "z$id1" != "z$id2"
'
for enc in 7bit 8bit quoted-printable base64
do
test_expect_success $PREREQ "--transfer-encoding=$enc produces correct header" '