From 71fe12b6d68d95cb72dcfe769ed79760e3a1efed Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Wed, 15 Apr 2020 14:42:28 -0400 Subject: 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 Signed-off-by: Konstantin Ryabitsev --- b4/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3