Skip to content

Commit 2ddb604

Browse files
committed
Add test to verify GitCommandError is raised when check-ignore is run against a file behind a symlink
1 parent 7ada83a commit 2ddb604

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎test/test_repo.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -1399,4 +1399,15 @@ def test_ignored_items_reported(self):
13991399
assert temp_repo.ignored(['included_file.txt', 'included_dir/file.txt']) == []
14001400
assert temp_repo.ignored(['ignored_file.txt']) == ['ignored_file.txt']
14011401
assert temp_repo.ignored(['included_file.txt', 'ignored_file.txt']) == ['ignored_file.txt']
1402-
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']
1402+
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']
1403+
1404+
def test_ignored_raises_error_w_symlink(self):
1405+
with tempfile.TemporaryDirectory() as tdir:
1406+
tmp_dir = pathlib.Path(tdir)
1407+
temp_repo = Repo.init(tmp_dir / "repo")
1408+
1409+
os.mkdir(tmp_dir / "target")
1410+
os.symlink(tmp_dir / "target", tmp_dir / "symlink")
1411+
1412+
with pytest.raises(GitCommandError):
1413+
temp_repo.ignored(tmp_dir / "symlink/file.txt")

0 commit comments

Comments
 (0)