Fix encoding on python 3.
authorJelmer Vernooij <jelmer@jelmer.uk>
Sat, 20 Oct 2018 21:51:23 +0000 (21:51 +0000)
committerJelmer Vernooij <jelmer@jelmer.uk>
Sat, 20 Oct 2018 21:51:23 +0000 (21:51 +0000)
dulwich/porcelain.py

index 4569eae84f3e6f1d3ce97c5ee2cc4ac3ece5735e..0e1234b32872afd998759fcac635a222bcf581db 100644 (file)
@@ -1401,6 +1401,8 @@ def get_object_by_path(repo, path, committish=None):
     with open_repo_closing(repo) as r:
         commit = parse_commit(repo, committish)
         base_tree = commit.tree
+        if not isinstance(path, bytes):
+            path = path.encode(commit.encoding or DEFAULT_ENCODING)
         (mode, sha) = tree_lookup_path(
             r.object_store.__getitem__,
             base_tree, path)