You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>import pygit2
>import sys
>r = pygit2.init_repository(r"C:\repösitory")
>r.path
'C:/repösitory/.git/' # this is a wrongly decoded path
>r.path.encode(sys.getfilesystemencoding()).decode("utf-8") # workaround
'C:/repösitory/.git/' # this looks right
Reproduced with "pygit2-0.28.2-cp35-cp35m-win32.whl".
The problem seems to be in "repository.c", function "Repository_path__get__":
return to_path(git_repository_path(self->repo));
The "to_path" function assumes that libgit2 returns a byte string with file system encoding:
It seems that this issue is related to #537, which I commented, so I also write here.
If libgit2 on Windows returns a byte string encoded in UTF-8, it works correctly without extra encode/decode since Python >= 3.6 because the file system encoding on Windows is changed to 'utf-8' since then.
Example:
Reproduced with "pygit2-0.28.2-cp35-cp35m-win32.whl".
The problem seems to be in "repository.c", function "Repository_path__get__":
The "to_path" function assumes that libgit2 returns a byte string with file system encoding:
But libgit2 actually returns a byte string encoded in UTF-8.
Maybe the behaviour of libgit2 has changed at some point?
The text was updated successfully, but these errors were encountered: