diff options
author | Ruben DI BATTISTA <ruben.di_battista@qube-rt.com> | 2022-05-17 16:58:14 +0200 |
---|---|---|
committer | Ruben DI BATTISTA <ruben.di_battista@qube-rt.com> | 2022-05-18 13:01:42 +0200 |
commit | 8232b170a28f946f5a04472912b3e73777c44465 (patch) | |
tree | 833dfce594c5606e78fb536bc383580ab33d09c2 /test/test_index.py | |
parent | 38e9a18b976b2b7e3b3cd0fcd5b037573823d7c2 (diff) | |
download | gitpython-8232b170a28f946f5a04472912b3e73777c44465.tar.gz |
fix: Allow adding PathLike object to index
Close #1382
Diffstat (limited to 'test/test_index.py')
-rw-r--r-- | test/test_index.py | 11 |
1 files changed, 11 insertions, 0 deletions
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 |