libgit2/libgit2 — Issue #462: git_path_basename_r does not handle Windows paths?
Author: jdavid
Created: 2011-10-18 14:35:07+00:00
State: open

I am trying to get the pygit2 unit tests to pass on Windows. I have hit an issue which may be related to libgit2's handling of paths, specifically in the ``git_path_basename_r`` function.

For once I will post here Python code instead of C:

>>> from pygit2 import Repository
>>> path = r'C:\Documents and Settings\Administrateur\libgit2\.git'
>>> repo = Repository(path)
>>> print repo.path
C:/Documents and Settings/Administrateur/libgit2/.git/
>>> print repo.workdir
None
>>> print repo.index
None

Well, I don't do Windows often, but I think the input path is right.

What happens is that ``git_path_basename_r`` says the basename is the whole input path, because it checks against the unix path separator ``/``