Skip to content

Commit 0eafe20

Browse files
committed
Add test case as example of Git commit with invalid data
This is a real commit from the microjs.com open source project, see microjs/microjs.com@7e8457c, 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.
1 parent e836e5c commit 0eafe20

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

git/test/fixtures/commit_invalid_data

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
tree 9f1a495d7d9692d24f5caedaa89f5c2c32d59368
2+
parent 492ace2ffce0e426ebeb55e364e987bcf024dd3b
3+
author E.Azer Ko�o�o�oculu <azer@kodfabrik.com> 1306710073 +0300
4+
committer E.Azer Ko�o�o�oculu <azer@kodfabrik.com> 1306710073 +0300
5+
6+
add environjs

git/test/test_commit.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,13 @@ def test_serialization_unicode_support(self):
306306
# it appears
307307
cmt.author.__repr__()
308308

309+
def test_invalid_commit(self):
310+
cmt = self.rorepo.commit()
311+
cmt._deserialize(open(fixture_path('commit_invalid_data'), 'rb'))
312+
313+
assert cmt.author.name == u'E.Azer Ko�o�o�oculu', cmt.author.name
314+
assert cmt.author.email == 'azer@kodfabrik.com', cmt.author.email
315+
309316
def test_gpgsig(self):
310317
cmt = self.rorepo.commit()
311318
cmt._deserialize(open(fixture_path('commit_with_gpgsig'), 'rb'))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy