From d3bf98ea006f9949b16ad10f7d2c88d6809b8619 Mon Sep 17 00:00:00 2001 From: Vanya Sergeev Date: Fri, 11 Oct 2013 10:27:21 -0700 Subject: [PATCH] Fix parsing of empty commit messages --- git.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git.py b/git.py index d005b13..f0e73ba 100644 --- a/git.py +++ b/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)