diff options
author | Vincent Driessen <me@nvie.com> | 2016-05-24 19:27:32 +0200 |
---|---|---|
committer | Vincent Driessen <me@nvie.com> | 2016-05-24 19:27:32 +0200 |
commit | 187fe114585be2d367a81997509b40e62fdbc18e (patch) | |
tree | ea10669ea7b9e610a068aec273e5524d1778b066 | |
parent | 903826a50d401d8829912e4bcd8412b8cdadac02 (diff) | |
download | gitpython-187fe114585be2d367a81997509b40e62fdbc18e.tar.gz |
Ignore trailing last empty string in .split() output
-rw-r--r-- | git/repo/base.py | 5 |
1 files changed, 1 insertions, 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) |