aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-06-08 11:53:30 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-06-08 11:53:30 -0400
commit31f33fd215590c40a03961580eb33bb1f9616835 (patch)
treee60c89476b66fcc3dbf219dab53868ccb85f6529
parentfb8301d9f0cb38bde3bd37906a0bf7f69ae6ce8b (diff)
downloadb4-31f33fd215590c40a03961580eb33bb1f9616835.tar.gz
Fix body part parsing when '---' is not used
If the commit message is not separated from the diff using '---' as is commonly the case, fall back to splitting by the word "diff". Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index b5b4f99..cee14f8 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -1199,6 +1199,11 @@ class LoreMessage:
parts = body.split('\n---\n', 1)
if len(parts) == 2:
basement = parts[1].rstrip('\n')
+ elif body.find('\ndiff ') >= 0:
+ parts = body.split('\ndiff ', 1)
+ if len(parts) == 2:
+ parts[1] = 'diff ' + parts[1]
+ basement = parts[1].rstrip('\n')
mbody = parts[0].strip('\n')