diff options
author | Vincent Driessen <me@nvie.com> | 2016-05-30 16:20:22 +0200 |
---|---|---|
committer | Vincent Driessen <me@nvie.com> | 2016-05-30 16:32:26 +0200 |
commit | 0eafe201905d85be767c24106eb1ab12efd3ee22 (patch) | |
tree | 964391a26b5eefb0289d1d61d0e34740c5c7cecf /git/test/test_commit.py | |
parent | e836e5cdcc7e3148c388fe8c4a1bab7eeb00cc3f (diff) | |
download | gitpython-0eafe201905d85be767c24106eb1ab12efd3ee22.tar.gz |
Add test case as example of Git commit with invalid data
This is a real commit from the microjs.com open source project, see
https://github.com/madrobby/microjs.com/commit/7e8457c17850d0991763941213dcb403d80f39f8,
which is declared to be encoded in UTF-8, but contains invalid bytes.
This makes GitPython choke on it while decoding. Rather than choking,
this should instead accept the error and replace the invalid bytes by
the � (\x80) char.
Diffstat (limited to 'git/test/test_commit.py')
-rw-r--r-- | git/test/test_commit.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/git/test/test_commit.py b/git/test/test_commit.py index 23b7154a..ea8cd9af 100644 --- a/git/test/test_commit.py +++ b/git/test/test_commit.py @@ -306,6 +306,13 @@ class TestCommit(TestBase): # it appears cmt.author.__repr__() + def test_invalid_commit(self): + cmt = self.rorepo.commit() + cmt._deserialize(open(fixture_path('commit_invalid_data'), 'rb')) + + assert cmt.author.name == u'E.Azer Ko�o�o�oculu', cmt.author.name + assert cmt.author.email == 'azer@kodfabrik.com', cmt.author.email + def test_gpgsig(self): cmt = self.rorepo.commit() cmt._deserialize(open(fixture_path('commit_with_gpgsig'), 'rb')) |