summaryrefslogtreecommitdiff
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 12:30:02 -0400
commitc15b77e0eb0a7939aea61019aa066d0ce97c66ec (patch)
tree49093349f958159ed8d1bb6c49744aaac673a8e3
parent92be4a8e4a5f1c57fc7ebd1378d1870e7af68435 (diff)
downloadb4-c15b77e0eb0a7939aea61019aa066d0ce97c66ec.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 a515ac6..fe0a8a1 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')