From 8232b170a28f946f5a04472912b3e73777c44465 Mon Sep 17 00:00:00 2001 From: Ruben DI BATTISTA Date: Tue, 17 May 2022 16:58:14 +0200 Subject: fix: Allow adding PathLike object to index Close #1382 --- test/test_index.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test/test_index.py') diff --git a/test/test_index.py b/test/test_index.py index d6e0fb81..3bebb382 100644 --- a/test/test_index.py +++ b/test/test_index.py @@ -37,6 +37,8 @@ from gitdb.base import IStream import os.path as osp from git.cmd import Git +from pathlib import Path + HOOKS_SHEBANG = "#!/usr/bin/env sh\n" is_win_without_bash = is_win and not shutil.which("bash.exe") @@ -943,3 +945,12 @@ class TestIndex(TestBase): assert str(err) else: raise AssertionError("Should have caught a HookExecutionError") + + @with_rw_repo('HEAD') + def test_index_add_pathlike(self, rw_repo): + git_dir = Path(rw_repo.git_dir) + + file = git_dir / "file.txt" + file.touch() + + rw_repo.index.add(file) \ No newline at end of file -- cgit v1.2.1