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

7
git.py

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