Make workspace member inclusion/exclusion more useful, consistent, and intuitive #11405
Open
4 tasks
Labels
A-manifest
Area: Cargo.toml issues
A-workspaces
Area: workspaces
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-design
Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Problem
As of now, Cargo supports glob syntax for
workspace.member
to include crates as workspace members. However, forworkspace.exclude
it is implemented by a plainstarts_with
comparing with manifest path of certain crates. This confuses people as they need to figure out which rules overrides the other. It is also inconsistent withpackage.include
andpackage.exclude
, as they choose gitignore syntax.For
workspace.member
, it proactively checks the existence ofCargo.toml
to include a member, and throws an errors ifCargo.toml
doesn't exist, which makes globbing**/*
often invalid.Similar issues have been raised from time to time:
exclude
doesn't work if nested under amember
path #6745member
under[workspace]
, Glob pattern doesn’t work for paths whose parent isexclude
d #11362Proposed Solution
There are several possible ways to "fix" the situation (to some extent).
workspace.exclude
. Add globbing toworkspace.exclude
list #11374 tries to do that. This is a relatively low effort approach but might confuse people still, and it won't fix Workspaceexclude
doesn't work if nested under amember
path #6745.member
under[workspace]
, Glob pattern doesn’t work for paths whose parent isexclude
d #11362 (comment), we talked about using a singleworkspace.member
and dropworkspace.exclude
. However, the re-include is not possible due to the limit of gitignore itself1.starts_with
and instead check the existence ofCargo.toml
to exclude a package.There might be other possible solution I am not aware of here.
Notes
I would keep this as the main issue and close some. If this is inappropriate, please say it out load, and we can reopen the original issues.
Footnotes
An optional prefix "!" which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded.
See https://git-scm.com/docs/gitignore#_pattern_format ↩
The text was updated successfully, but these errors were encountered: