Add globbing to workspace.exclude
list
#11374
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Hello, I've added the ability to use globs in
workspace.exclude
to facilitate easier usage of git submodules as dependencies.A common way of using git submodules is to have them all under a subfolder like
repos
orthird-party
and it would be nice to be able to just add new submodules without having to change theworkspace.exclude
list every time.This small change allows the usage of globs in
workspace.exclude
just like it's allowed inworkspace.members
eg:Implementation
The current implementation is not ideal as it just silently eats any globbing errors. However, in the interest of making the change as minimal as possible for the initial round of reviews, I deemed that acceptable.
If desired I can refactor the
is_excluded
function to return aCargoResult<bool>
similar to whatexpand_member_path
does for its glob handling.Testing
I've added a test case to the testsuite called
excluded_glob
which should cover most cases but I'm open to hear if I missed any edge cases.