Skip to content

Commit

Permalink
fix(api/tracking): ingore symlinks
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Feb 26, 2024
1 parent 999650e commit b77ae99
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
11 changes: 11 additions & 0 deletions api/outdated/outdated/tests/test_tracking.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from pathlib import Path
from unittest.mock import PropertyMock, call

import pytest
Expand Down Expand Up @@ -283,6 +284,16 @@ def test_lockfiles(db, project, tmp_repo_root, exists):
assert not exists


def test_lockfiles_ignore_symlinks(db, project, tmp_repo_root):
tracker = Tracker(project)
tracker.local_path.mkdir(parents=True, exist_ok=False)

lockfiles = tracker.lockfiles
assert lockfiles == []
(tracker.local_path / "yarn.lock").symlink_to(Path("/proc/1/environ"))
assert tracker.lockfiles == []


@pytest.mark.django_db()
def test_delete(tmp_repo_root, project_factory):
project = project_factory(repo="my.git.com/foo/bar")
Expand Down
8 changes: 7 additions & 1 deletion api/outdated/outdated/tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ def lockfiles(self):
if ".git" in dirs:
dirs.remove(".git")

lockfile_list.extend([Path(root).joinpath(file) for file in files])
lockfile_list.extend(
[
Path(root).joinpath(file)
for file in files
if not Path(root).joinpath(file).is_symlink()
]
)

return lockfile_list

Expand Down

0 comments on commit b77ae99

Please sign in to comment.