]> git.ipfire.org Git - thirdparty/git.git/commit
send-email: clear the $message_id after validation
authorJunio C Hamano <gitster@pobox.com>
Wed, 17 May 2023 21:10:39 +0000 (14:10 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 May 2023 21:11:38 +0000 (14:11 -0700)
commit3ece9bf0f9e24909b090cf348d89e8920bd4f82f
tree936a362a2fc1ca6e3ea3befdb2718ebf94d3b715
parenta8022c5f7b678189135b6caa3fadb3d8ec0c0d48
send-email: clear the $message_id after validation

Recently git-send-email started parsing the same message twice, once
to validate _all_ the message before sending even the first one, and
then after the validation hook is happy and each message gets sent,
to read the contents to find out where to send to etc.

Unfortunately, the effect of reading the messages for validation
lingered even after the validation is done.  Namely $message_id gets
assigned if exists in the input files but the variable is global,
and it is not cleared before pre_process_file runs.  This causes
reading a message without a message-id followed by reading a message
with a message-id to misbehave---the sub reports as if the message
had the same id as the previously written one.

Clear the variable before starting to read the headers in
pre_process_file.

Tested-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-send-email.perl
t/t9001-send-email.sh