diff options
author | Axel Aguado <axelaguado@gmail.com> | 2023-01-21 15:05:33 -0600 |
---|---|---|
committer | Axel Aguado <axelaguado@gmail.com> | 2023-01-21 15:32:03 -0600 |
commit | 2ddb604ae8a7fd1069857c8194155d109565e6bb (patch) | |
tree | fef24a71feb99dce6163fbacdcf590deda3b4431 /test/test_repo.py | |
parent | 7ada83a4cf83c1178159c250a11811012506058c (diff) | |
download | gitpython-2ddb604ae8a7fd1069857c8194155d109565e6bb.tar.gz |
Add test to verify GitCommandError is raised when check-ignore is run against a file behind a symlink
Diffstat (limited to 'test/test_repo.py')
-rw-r--r-- | test/test_repo.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/test_repo.py b/test/test_repo.py index c21f3270..07c1e9ad 100644 --- a/test/test_repo.py +++ b/test/test_repo.py @@ -1399,4 +1399,15 @@ class TestRepo(TestBase): assert temp_repo.ignored(['included_file.txt', 'included_dir/file.txt']) == [] assert temp_repo.ignored(['ignored_file.txt']) == ['ignored_file.txt'] assert temp_repo.ignored(['included_file.txt', 'ignored_file.txt']) == ['ignored_file.txt'] - assert temp_repo.ignored(['included_file.txt', 'ignored_file.txt', 'included_dir/file.txt', 'ignored_dir/file.txt']) == ['ignored_file.txt', 'ignored_dir/file.txt']
\ No newline at end of file + assert temp_repo.ignored(['included_file.txt', 'ignored_file.txt', 'included_dir/file.txt', 'ignored_dir/file.txt']) == ['ignored_file.txt', 'ignored_dir/file.txt'] + + def test_ignored_raises_error_w_symlink(self): + with tempfile.TemporaryDirectory() as tdir: + tmp_dir = pathlib.Path(tdir) + temp_repo = Repo.init(tmp_dir / "repo") + + os.mkdir(tmp_dir / "target") + os.symlink(tmp_dir / "target", tmp_dir / "symlink") + + with pytest.raises(GitCommandError): + temp_repo.ignored(tmp_dir / "symlink/file.txt")
\ No newline at end of file |