aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-15 14:42:28 -0400
committerKonstantin Ryabitsev <konstantin@linuxfoundation.org>2020-04-15 14:42:28 -0400
commit71fe12b6d68d95cb72dcfe769ed79760e3a1efed (patch)
treea24cc43b063e54b086c30fb7acd839ad93d40ea2
parentc4469dc30c30f629b1d725b663d80e8a78956c61 (diff)
downloadb4-71fe12b6d68d95cb72dcfe769ed79760e3a1efed.tar.gz
Don't break on @@ -N,N +N @@ diff lines
When a commit is a new file with only one line, the diff output is different, so handle it without breaking. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rw-r--r--b4/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/b4/__init__.py b/b4/__init__.py
index e511f51..d42051d 100644
--- a/b4/__init__.py
+++ b/b4/__init__.py
@@ -877,7 +877,10 @@ class LoreMessage:
if hunk_match:
# logger.debug('Crunching %s', line)
mlines, plines = hunk_match.groups()
- pp = int(plines)
+ try:
+ pp = int(plines)
+ except TypeError:
+ pp = 1
addlines = list()
for bline in reversed(buflines):
# Go backward and add lines until we get to the start