aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-07-27 11:38:05 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-07-27 11:38:05 -0400
commitb69289cd926d44e08c7d139b3487bf5e1d432aad (patch)
treed9b9283e18710caa2e2095a4c7c6297155606872
parentc42498c7247a23cf51ef9f5fd652b1e582bc4fc9 (diff)
downloadb4-b69289cd926d44e08c7d139b3487bf5e1d432aad.tar.gz
Fix some of the more common trailer wrapping
When copypasting patches into mail clients, trailers sometimes get mangled due to MUAs helpfully breaking long lines. Not sure if this causes more harm than good, but let's try to run some tests with this. Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index 56dd751..245a0db 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1215,6 +1215,14 @@ class LoreMessage:
mbody = parts[0].strip('\n')
+ # Fix some more common copypasta trailer wrapping
+ # Fixes: abcd0123 (foo bar
+ # baz quux)
+ mbody = re.sub(r'^(\S+:\s+[0-9a-f]+\s+\([^\)]+)\n([^\n]+\))', r'\1 \2', mbody, flags=re.M)
+ # Signed-off-by: Long Name
+ # <email.here@example.com>
+ mbody = re.sub(r'^(\S+:\s+[^<]+)\n(<[^>]+>)', r'\1 \2', mbody, flags=re.M)
+
# Split into paragraphs
bpara = mbody.split('\n\n')