Browse Source

Replace / with \ on windows.

Jelmer Vernooij 6 years ago
parent
commit
c6fd24506f
2 changed files with 3 additions and 0 deletions
  1. 2 0
      dulwich/porcelain.py
  2. 1 0
      dulwich/tests/test_porcelain.py

+ 2 - 0
dulwich/porcelain.py

@@ -188,6 +188,8 @@ def path_to_tree_path(repopath, path):
     treepath = os.path.relpath(path, repopath)
     if treepath.startswith(b'..'):
         raise ValueError('Path not in repo')
+    if os.path.sep != '/':
+        treepath = treepath.replace(os.path.sep.encode('ascii'), b'/')
     return treepath
 
 

+ 1 - 0
dulwich/tests/test_porcelain.py

@@ -1490,6 +1490,7 @@ class DescribeTests(PorcelainTestCase):
 
 
 class HelperTests(PorcelainTestCase):
+
     def test_path_to_tree_path_base(self):
         self.assertEqual(
             b'bar', porcelain.path_to_tree_path('/home/foo', '/home/foo/bar'))