summaryrefslogtreecommitdiff
path: root/git/test/test_index.py
diff options
context:
space:
mode:
authorRuslan Kuprieiev <kupruser@gmail.com>2018-04-03 14:39:44 +0300
committerSebastian Thiel <byronimo@gmail.com>2018-04-04 09:35:57 +0200
commit0857d33852b6b2f4d7bc470b4c97502c7f978180 (patch)
tree92fa55c07313d4fb8459716413eb47dcd5b62662 /git/test/test_index.py
parente79a3f8f6bc6594002a0747dd4595bc6b88a2b27 (diff)
downloadgitpython-0857d33852b6b2f4d7bc470b4c97502c7f978180.tar.gz
git: index: base: use os.path.relpath
Fixes #743 Signed-off-by: Ruslan Kuprieiev <kupruser@gmail.com>
Diffstat (limited to 'git/test/test_index.py')
-rw-r--r--git/test/test_index.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/git/test/test_index.py b/git/test/test_index.py
index 9be4031d..a30d314b 100644
--- a/git/test/test_index.py
+++ b/git/test/test_index.py
@@ -838,6 +838,21 @@ class TestIndex(TestBase):
r.index.add([fp])
r.index.commit('Added [.exe')
+ def test__to_relative_path_at_root(self):
+ root = osp.abspath(os.sep)
+
+ class Mocked(object):
+ bare = False
+ git_dir = root
+ working_tree_dir = root
+
+ repo = Mocked()
+ path = os.path.join(root, 'file')
+ index = IndexFile(repo)
+
+ rel = index._to_relative_path(path)
+ self.assertEqual(rel, os.path.relpath(path, root))
+
@with_rw_repo('HEAD', bare=True)
def test_pre_commit_hook_success(self, rw_repo):
index = rw_repo.index