Skip to content

Commit 2ff3a3e

Browse files
committed
fix(blame): lazily fetch full commit message
That way, we will not only get the summary line contained in the blame, but fetch the full message. This is more costly than the previous implementation allowed it to be, but being less surprising/correct certainly is the preferred behaviour here. Fixes #485
1 parent 0ed3cd7 commit 2ff3a3e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Diff for: git/repo/base.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -714,8 +714,7 @@ def blame_incremental(self, rev, file, **kwargs):
714714
authored_date=int(props[b'author-time']),
715715
committer=Actor(safe_decode(props[b'committer']),
716716
safe_decode(props[b'committer-mail'].lstrip(b'<').rstrip(b'>'))),
717-
committed_date=int(props[b'committer-time']),
718-
message=safe_decode(props[b'summary']))
717+
committed_date=int(props[b'committer-time']))
719718
commits[hexsha] = c
720719
else:
721720
# Discard the next line (it's a filename end tag)
@@ -815,8 +814,7 @@ def blame(self, rev, file, incremental=False, **kwargs):
815814
authored_date=info['author_date'],
816815
committer=Actor._from_string(
817816
info['committer'] + ' ' + info['committer_email']),
818-
committed_date=info['committer_date'],
819-
message=info['summary'])
817+
committed_date=info['committer_date'])
820818
commits[sha] = c
821819
# END if commit objects needs initial creation
822820
if not is_binary:

Diff for: git/test/test_repo.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def test_should_display_blame_information(self, git):
307307
assert_equal('Tom Preston-Werner', c.committer.name)
308308
assert_equal('[email protected]', c.committer.email)
309309
assert_equal(1191997100, c.committed_date)
310-
assert_equal('initial grit setup', c.message)
310+
self.assertRaisesRegexp(ValueError, "634396b2f541a9f2d58b00be1a07f0c358b999b3 missing", lambda: c.message)
311311

312312
# test the 'lines per commit' entries
313313
tlist = b[0][1]

0 commit comments

Comments
 (0)