Fix parsing of empty commit messages

This commit is contained in:
Vanya Sergeev 2013-10-11 10:27:21 -07:00 committed by Alberto Bertogli
parent 6f5f3c4aa5
commit d3bf98ea00

5
git.py

@ -397,7 +397,12 @@ class Commit (object):
@staticmethod @staticmethod
def from_str(repo, buf): def from_str(repo, buf):
"""Parses git rev-list output, returns a commit object.""" """Parses git rev-list output, returns a commit object."""
if '\n\n' in buf:
# Header, commit message
header, raw_message = buf.split('\n\n', 1) header, raw_message = buf.split('\n\n', 1)
else:
# Header only, no commit message
header, raw_message = buf.rstrip(), ' '
header_lines = header.split('\n') header_lines = header.split('\n')
commit_id = header_lines.pop(0) commit_id = header_lines.pop(0)