diff options
author | Jonathan Chu <jonathan.chu@me.com> | 2016-05-24 11:19:14 -0400 |
---|---|---|
committer | Jonathan Chu <jonathan.chu@me.com> | 2016-05-24 11:19:14 -0400 |
commit | 73ab28744df3fc292a71c3099ff1f3a20471f188 (patch) | |
tree | b7cf89ea66fb2f21988d2833644a91d83ba9904d /git/repo/base.py | |
parent | 7a8f96cc8a5135a0ece19e600da914dabca7d215 (diff) | |
download | gitpython-73ab28744df3fc292a71c3099ff1f3a20471f188.tar.gz |
Split lines by new line characters
Opt to split lines by the new line character instead of letting
`splitlines()` do this. This helps catch the issue when there are
special characters in the line, particular the commit summary section.
Diffstat (limited to 'git/repo/base.py')
-rw-r--r-- | git/repo/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/git/repo/base.py b/git/repo/base.py index c2bd2a62..af3050bf 100644 --- a/git/repo/base.py +++ b/git/repo/base.py @@ -682,10 +682,12 @@ class Repo(object): data = self.git.blame(rev, '--', file, p=True, incremental=True, stdout_as_string=False, **kwargs) commits = dict() - stream = iter(data.splitlines()) + stream = iter(data.split(b'\n')) while True: line = next(stream) # when exhausted, casues a StopIteration, terminating this function - + if line.strip() == '': + # Skip over empty lines + continue hexsha, orig_lineno, lineno, num_lines = line.split() lineno = int(lineno) num_lines = int(num_lines) |