{"thread":{"id":"55832","subject":"why does git-send-email unwrap headers?","startedAt":"2021-06-02T15:36:02Z","lastAt":"2021-06-02T18:04:48Z","messageCount":3,"participants":["Konstantin Ryabitsev","Taylor Blau"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"426240","messageId":"20210602153441.cjmey63x2vudlnk6@nitro.local","threadId":"55832","inReplyTo":null,"subject":"why does git-send-email unwrap headers?","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2021-06-02T15:34:41Z","receivedAt":"2021-06-02T15:36:02Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"Hello:\n\nI've noticed that when a message is sent with git-send-email, it will unwrap\nall existing headers into a single line, such that:\n\n    Some-header: This is a long header that happens to be longer than 78\n     characters and is therefore wrapped at whitespace chars to properly span\n     across multiple lines\n\nbecomes:\n\n    Some-header: This is a long header that happens to be longer than 78 characters and is therefore wrapped at whitespace chars to properly span across multiple lines\n\nWhile it's not *wrong* (the 78-character limit is from a very old RFC), I'm\ncurious if this is intentional or just an oversight.\n\n-K\n"},{"id":"426241","messageId":"YLe3k1CYMhv9LEeh@nand.local","threadId":"55832","inReplyTo":"20210602153441.cjmey63x2vudlnk6@nitro.local","subject":"Re: why does git-send-email unwrap headers?","fromName":"Taylor Blau","fromEmail":"me@ttaylorr.com","sentAt":"2021-06-02T16:53:39Z","receivedAt":"2021-06-02T16:53:43Z","isPatch":false,"sender":{"key":"me@ttaylorr.com","avatar":"https://avatars.githubusercontent.com/u/301000140?v=4"},"body":"On Wed, Jun 02, 2021 at 11:34:41AM -0400, Konstantin Ryabitsev wrote:\n> While it's not *wrong* (the 78-character limit is from a very old RFC), I'm\n> curious if this is intentional or just an oversight.\n\nMy guess is that this dates back to 5012699d98 (send-email: handle\nmultiple Cc addresses when reading mbox message, 2009-02-14), which\nunfolds all multi-line headers, probably so that parsing the header can\nbe done line-wise without having to keep track of whether you are\nparsing a continuation line or not.\n\nPerl's Mail::Header [1] looks to have support for folding a header\nacross multiple lines, but I'd just as soon defer to the Perl experts\naround here for help using it :).\n\nThanks,\nTaylor\n\n[1]: https://metacpan.org/pod/Mail::Header\n"},{"id":"426245","messageId":"20210602180443.girwpb2ovwczywmk@nitro.local","threadId":"55832","inReplyTo":"YLe3k1CYMhv9LEeh@nand.local","subject":"Re: why does git-send-email unwrap headers?","fromName":"Konstantin Ryabitsev","fromEmail":"konstantin@linuxfoundation.org","sentAt":"2021-06-02T18:04:43Z","receivedAt":"2021-06-02T18:04:48Z","isPatch":false,"sender":{"key":"konstantin@linuxfoundation.org","avatar":"https://gravatar.com/avatar/7cb8827c6de56e1bd2dea16508c6708aa43feed3bf3813bcdacecdf96ceadd79?d=mp&s=160"},"body":"On Wed, Jun 02, 2021 at 12:53:39PM -0400, Taylor Blau wrote:\n> On Wed, Jun 02, 2021 at 11:34:41AM -0400, Konstantin Ryabitsev wrote:\n> > While it's not *wrong* (the 78-character limit is from a very old RFC), I'm\n> > curious if this is intentional or just an oversight.\n> \n> My guess is that this dates back to 5012699d98 (send-email: handle\n> multiple Cc addresses when reading mbox message, 2009-02-14), which\n> unfolds all multi-line headers, probably so that parsing the header can\n> be done line-wise without having to keep track of whether you are\n> parsing a continuation line or not.\n\nI think you're right, but I believe simply removing the two lines that do the\nactual unwrapping will fix this without causing any side-effects.\n\nI.e. when parsing headers, don't \"unwrap\" them but merely concatenate all\nheader lines to the proper header. Address parsing routines should still\nproperly handle this situation, though it's less clear to me if something else\nmay be affected by this change.\n\nCC'ing Ævar Arnfjörð Bjarmason, who I think is the person most poking at\ngit-send-email lately.\n\n-- >8 --\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 25be2ebd2a..4c79122f78 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1654,8 +1654,6 @@ sub process_file {\n        while(<$fh>) {\n                last if /^\\s*$/;\n                if (/^\\s+\\S/ and @header) {\n-                   chomp($header[$#header]);\n-                   s/^\\s+/ /;\n                        $header[$#header] .= $_;\n            } else {\n                        push(@header, $_);\n\n-- >8 --\n\n-K\n"}]}