Replace / with \ on windows.
authorJelmer Vernooij <jelmer@jelmer.uk>
Tue, 21 Aug 2018 22:28:46 +0000 (23:28 +0100)
committerJelmer Vernooij <jelmer@jelmer.uk>
Tue, 21 Aug 2018 22:28:46 +0000 (23:28 +0100)
dulwich/porcelain.py
dulwich/tests/test_porcelain.py

index f6b0db4045d16fcbbda050bb69e7031417e9d7a8..28e7831f817c2e04973a14f9786dce0892087187 100644 (file)
@@ -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
 
 
index 49cf1d76338bd35bac2f0b0302ef67fd080c098e..6c7f5f8a3e628d9c5f02a663c55b1eda3dce163c 100644 (file)
@@ -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'))