File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ def _onerror(exc: OSError) -> None:
5252 if ".git" in dirnames or ".git" in filenames :
5353 repos .add (current )
5454 for dirname in dirnames :
55+ if dirname in prune :
56+ continue
5557 child = current / dirname
5658 try :
5759 if child .is_symlink () and ((child / ".git" ).is_dir () or (child / ".git" ).is_file ()):
Original file line number Diff line number Diff line change @@ -69,6 +69,17 @@ def test_discover_reports_sole_directory_symlink_alias(tmp_path: Path):
6969 assert discover_repos (alias .parent , Config ()) == [alias ]
7070
7171
72+ def test_discover_prunes_directory_symlink_repo_alias (tmp_path : Path ):
73+ if os .name == "nt" :
74+ pytest .skip ("directory symlink behavior covered on POSIX; Windows uses junction fixture" )
75+ target = tmp_path / "outside" / "target"
76+ _make_repo (target )
77+ alias = tmp_path / "scan-root" / "node_modules"
78+ alias .parent .mkdir ()
79+ alias .symlink_to (target , target_is_directory = True )
80+ assert discover_repos (alias .parent , Config ()) == []
81+
82+
7283def test_deduplicate_repo_aliases_collapses_mocked_physical_identity (
7384 tmp_path : Path , monkeypatch
7485):
You can’t perform that action at this time.
0 commit comments