diff options
-rw-r--r-- | lib/git/commit.py | 8 | ||||
-rw-r--r-- | test/git/test_repo.py | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/git/commit.py b/lib/git/commit.py index c9e2ab59..4aee1280 100644 --- a/lib/git/commit.py +++ b/lib/git/commit.py @@ -41,7 +41,7 @@ class Commit(LazyMixin): is the committed DateTime ``message`` - is the first line of the commit message + is the commit message ``parents`` is the list of the parents of the commit @@ -81,6 +81,10 @@ class Commit(LazyMixin): def id_abbrev(self): return self.id[0:7] + @property + def summary(self): + return self.message.split('\n', 1)[0] + @classmethod def count(cls, repo, ref, path=''): """ @@ -159,7 +163,7 @@ class Commit(LazyMixin): while lines and lines[0].startswith(' '): messages.append(lines.pop(0).strip()) - message = messages and messages[0] or '' + message = '\n'.join(messages) commits.append(Commit(repo, id=id, parents=parents, tree=tree, author=author, authored_date=authored_date, committer=committer, committed_date=committed_date, message=message)) diff --git a/test/git/test_repo.py b/test/git/test_repo.py index e5264a0d..8b767744 100644 --- a/test/git/test_repo.py +++ b/test/git/test_repo.py @@ -67,7 +67,7 @@ class TestRepo(object): c = commits[2] assert_equal(["6e64c55896aabb9a7d8e9f8f296f426d21a78c2c", "7f874954efb9ba35210445be456c74e037ba6af2"], map(lambda p: p.id, c.parents)) - assert_equal("Merge branch 'site'", c.message) + assert_equal("Merge branch 'site'", c.summary) assert_true(git.called) assert_equal(git.call_args, (('rev_list', 'master', '--', ''), {'skip': 0, 'pretty': 'raw', 'max_count': 10})) |