{"thread":{"id":"64159","subject":"[PATCH] send-email: don't duplicate Reply-to: in intro message","startedAt":"2025-09-17T06:32:30Z","lastAt":"2025-09-17T14:05:12Z","messageCount":3,"participants":["NeilBrown","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"526544","messageId":"175809074627.1696783.67425889158412786@noble.neil.brown.name","threadId":"64159","inReplyTo":null,"subject":"[PATCH] send-email: don't duplicate Reply-to: in intro message","fromName":"NeilBrown","fromEmail":"neilb@ownmail.net","sentAt":"2025-09-17T06:32:26Z","receivedAt":"2025-09-17T06:32:30Z","isPatch":true,"sender":{"key":"neilb@ownmail.net","avatar":null},"body":"\nFrom: NeilBrown <neil@brown.name>\n\nIf I run\n\n  git send-email --compose --reply-to 'ME <my@address.net>' .....\n\nand edit the intro message, then it will get two copies of the Reply-To\nfield.  gmail.com rejects such messages.\n\nThis happens because send-email reads the edited message examining the\nheaders.  For recognised headers the content is extract to use in\nconstructing the final message and for possible inclusion in the patch\nemails.  Unrecognised headers are gathered (in @xh) to be passed though\nuninterpreted.\n\nUnfortunately \"Reply-To\" is not recognised in this process so it is\nadded to @xh as an uninterpreted header, but also generated from the\n$reply_to variable in gen_header(), resulting in two copies\n\nSo:\n\nAdd parsing to the loop in pre_process_file() to recognise a Reply-to\nheader and to store the result in $reply_to.  This means that the\nintro message will not get a second header and also means that\nany changes made to the Reply-To header during editing will be\nincorporated in the $reply_to variable and so included in all the\ngenerated email messages.\n\nSigned-off-by: NeilBrown <neil@brown.name>\n---\n git-send-email.perl | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 437f8ac46a85..e2248c223119 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1931,6 +1931,9 @@ sub pre_process_file {\n \t\t\t\t\t$in_reply_to = $1;\n \t\t\t\t}\n \t\t\t}\n+\t\t\telsif (/^Reply-To: (.*)/i) {\n+\t\t\t\t$reply_to = $1;\n+\t\t\t}\n \t\t\telsif (/^References: (.*)/i) {\n \t\t\t\tif (!$initial_in_reply_to || $thread) {\n \t\t\t\t\t$references = $1;\n-- \n2.50.0.107.gf914562f5916.dirty\n\n"},{"id":"526545","messageId":"CAPig+cSZ5aazWp9vacw7FBX4-b+PAKwRY-WfJL2HhjLOA3NUiw@mail.gmail.com","threadId":"64159","inReplyTo":"175809074627.1696783.67425889158412786@noble.neil.brown.name","subject":"Re: [PATCH] send-email: don't duplicate Reply-to: in intro message","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2025-09-17T06:56:10Z","receivedAt":"2025-09-17T06:56:22Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Wed, Sep 17, 2025 at 2:33 AM NeilBrown <neilb@ownmail.net> wrote:\n> If I run\n>\n>   git send-email --compose --reply-to 'ME <my@address.net>' .....\n>\n> and edit the intro message, then it will get two copies of the Reply-To\n> field.  gmail.com rejects such messages.\n>\n> This happens because send-email reads the edited message examining the\n> headers.  For recognised headers the content is extract to use in\n> constructing the final message and for possible inclusion in the patch\n> emails.  Unrecognised headers are gathered (in @xh) to be passed though\n> uninterpreted.\n\ns/extract/extracted/\ns/though/through/\n\n> Unfortunately \"Reply-To\" is not recognised in this process so it is\n> added to @xh as an uninterpreted header, but also generated from the\n> $reply_to variable in gen_header(), resulting in two copies\n>\n> So:\n>\n> Add parsing to the loop in pre_process_file() to recognise a Reply-to\n> header and to store the result in $reply_to.  This means that the\n> intro message will not get a second header and also means that\n> any changes made to the Reply-To header during editing will be\n> incorporated in the $reply_to variable and so included in all the\n> generated email messages.\n>\n> Signed-off-by: NeilBrown <neil@brown.name>\n"},{"id":"526574","messageId":"xmqqfrcli38p.fsf@gitster.g","threadId":"64159","inReplyTo":"175809074627.1696783.67425889158412786@noble.neil.brown.name","subject":"Re: [PATCH] send-email: don't duplicate Reply-to: in intro message","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-09-17T14:05:10Z","receivedAt":"2025-09-17T14:05:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"NeilBrown <neilb@ownmail.net> writes:\n\n> Add parsing to the loop in pre_process_file() to recognise a Reply-to\n> header and to store the result in $reply_to.  This means that the\n> intro message will not get a second header and also means that\n> any changes made to the Reply-To header during editing will be\n> incorporated in the $reply_to variable and so included in all the\n> generated email messages.\n>\n> Signed-off-by: NeilBrown <neil@brown.name>\n> ---\n>  git-send-email.perl | 3 +++\n>  1 file changed, 3 insertions(+)\n\nMakes sense.\n\nJust FYI for any future contributions, it is customary to mark the\nsecond iteration as [PATCH v2] on the subject and to make the\nmessage a direct reply (with \"Reply-To\") to the previous iteration,\nto help people find how the patch evolved in the list archives like\nhttps://lore.kernel.org/git/\n\nObviously no need to redo this patch only for that, but if you need\nsome other changes, sending v3 as a reply to the message I am\nresponding to would be a good thing to do.\n\nThanks.\n\n>\n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index 437f8ac46a85..e2248c223119 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -1931,6 +1931,9 @@ sub pre_process_file {\n>  \t\t\t\t\t$in_reply_to = $1;\n>  \t\t\t\t}\n>  \t\t\t}\n> +\t\t\telsif (/^Reply-To: (.*)/i) {\n> +\t\t\t\t$reply_to = $1;\n> +\t\t\t}\n>  \t\t\telsif (/^References: (.*)/i) {\n>  \t\t\t\tif (!$initial_in_reply_to || $thread) {\n>  \t\t\t\t\t$references = $1;\n"}]}