mricon / b4

Tool to help with email-based patch workflows
GNU General Public License v2.0
59 stars 20 forks source link

b4 send removes newlines from cover-letter #27

Open floatious opened 3 months ago

floatious commented 3 months ago

Hello there,

Sometimes there is a value in having two empty lines in a cover-letter, to more clearly separate certain paragraphs from other paragraphs.

Looking at the empty commit that contains the cover-letter, in e.g.: https://github.com/floatious/linux/commit/3be58ac3a3fb922daddc12b197aa439b46224fef

I can see that the cover-letter has two empty newlines in certain places, as intended.

However, if I look at the cover-letter that was actually sent to the list: https://lore.kernel.org/linux-pci/20240424-rockchip-pcie-ep-v1-v1-0-b1a02ddad650@kernel.org/

We can see that it has actually stripped the second empty line, in the cases where there were more than a single empty line. (With the result being that the cover-letter is harder to read IMO.)

If would be nice if b4 send did not strip newlines, or if nothing else, there could be an option to not strip newlines.

mricon commented 3 months ago

This is the side-effect of code that handles removing comments from the cover letter. E.g. consider the following contents:

This is the cover letter introduction 
paragraph

# Removed because this person is a secret agent
# Removed-trailer: Some Person <some.person@example.com>

Signed-off-by: My Self <...>

When we remove the comments, we end up with a double newline, that was most likely not intentional. So, we collapse all repeated newlines into a single one. I'll think about how we can recognize intentional double newlines, but it's not a simple change.