Fix tests on python3.
authorJelmer Vernooij <jelmer@jelmer.uk>
Sun, 8 Apr 2018 17:10:30 +0000 (18:10 +0100)
committerJelmer Vernooij <jelmer@jelmer.uk>
Sun, 8 Apr 2018 17:10:30 +0000 (18:10 +0100)
dulwich/objects.py
dulwich/tests/test_porcelain.py

index a4d7d44a4170e8f591286405da32326504d1f141..61bd122ebc23059a5e2378cfc77914a999cbed86 100644 (file)
@@ -1015,7 +1015,9 @@ class Tree(ShaFile):
                                           True):
             check_hexsha(sha, 'invalid sha %s' % sha)
             if b'/' in name or name in (b'', b'.', b'..', b'.git'):
-                raise ObjectFormatException('invalid name %s' % name)
+                raise ObjectFormatException(
+                        'invalid name %s' %
+                        name.decode('utf-8', 'replace'))
 
             if mode not in allowed_modes:
                 raise ObjectFormatException('invalid mode %06o' % mode)
index 721f6bc3a1cc580bcf6cd3eb0d09366c1e876319..efca46d7d4081d061aa221640f4e4b1162262a32 100644 (file)
@@ -1304,7 +1304,7 @@ class FsckTests(PorcelainTestCase):
     def test_git_dir(self):
         obj = Tree()
         a = Blob()
-        a.data = "foo"
+        a.data = b"foo"
         obj.add(b".git", 0o100644, a.id)
         self.repo.object_store.add_objects(
             [(a, None), (obj, None)])