diff --git a/hggit/git_handler.py b/hggit/git_handler.py index c705bd4236f4a1da0ab497a5afc228148b50a310_aGdnaXQvZ2l0X2hhbmRsZXIucHk=..a593069575bb4ed67916a8f12425884c4579c2b6_aGdnaXQvZ2l0X2hhbmRsZXIucHk= 100644 --- a/hggit/git_handler.py +++ b/hggit/git_handler.py @@ -19,6 +19,7 @@ from mercurial.node import hex, bin, nullid from mercurial import bookmarks from mercurial import commands +from mercurial import encoding from mercurial import context, util as hgutil from mercurial import url @@ -135,5 +136,11 @@ @hgutil.propertycache def git(self): + # Dulwich is going to try and join unicode ref names against + # the repository path to try and read unpacked refs. This + # doesn't match hg's bytes-only view of filesystems, we just + # have to cope with that. To cope, just decode the gitdir path + # in the local encoding and say a prayer that it decodes. + gitpath = self.gitdir.decode(encoding.encoding, encoding.encodingmode) # make the git data directory if os.path.exists(self.gitdir): @@ -138,5 +145,5 @@ # make the git data directory if os.path.exists(self.gitdir): - return Repo(self.gitdir) + return Repo(gitpath) else: os.mkdir(self.gitdir) @@ -141,6 +148,6 @@ else: os.mkdir(self.gitdir) - return Repo.init_bare(self.gitdir) + return Repo.init_bare(gitpath) def init_author_file(self): self.author_map = {}