Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix manifest filtering for different ecosystems #1247

Merged
merged 4 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Fixed
- Workspace lockfile generation for cargo, npm, yarn, and pnpm
- Go lockfile generation
- Ignored manifests with a different ecosystem's lockfile in a parent directory

## [5.7.1] - 2023-09-08

Expand Down
11 changes: 8 additions & 3 deletions lockfile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,9 +311,14 @@ pub fn find_lockable_files_at(root: impl AsRef<Path>) -> Vec<(PathBuf, LockfileF

let (manifest_path, _) = &manifests[i];

// Filter out manifests with a lockfile in a directory above them.
let mut lockfile_dirs = lockfiles.iter().filter_map(|(path, _)| path.parent());
remove |= lockfile_dirs.any(|lockfile_dir| manifest_path.starts_with(lockfile_dir));
// Filter out manifests with a lockfile with matching format in a directory
// above them.
let mut lockfile_dirs =
lockfiles.iter().filter_map(|(path, format)| Some((path.parent()?, format)));
remove |= lockfile_dirs.any(|(lockfile_dir, lockfile_format)| {
lockfile_format.parser().is_path_manifest(manifest_path)
&& manifest_path.starts_with(lockfile_dir)
});

// Filter out `setup.py` files with `pyproject.toml` present.
if manifest_path.ends_with("setup.py") {
Expand Down