From 187fe114585be2d367a81997509b40e62fdbc18e Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Tue, 24 May 2016 19:27:32 +0200 Subject: Ignore trailing last empty string in .split() output --- git/repo/base.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/git/repo/base.py b/git/repo/base.py index 32ee830e..bc5a7c35 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -682,12 +682,9 @@ class Repo(object): data = self.git.blame(rev, '--', file, p=True, incremental=True, stdout_as_string=False, **kwargs) commits = dict() - stream = iter(data.split(b'\n')) + stream = (line for line in data.split(b'\n') if line) while True: line = next(stream) # when exhausted, casues a StopIteration, terminating this function - if line.strip() == '' or line.strip() == b'': - # Skip over empty lines - continue hexsha, orig_lineno, lineno, num_lines = line.split() lineno = int(lineno) num_lines = int(num_lines) -- cgit v1.2.1