I am encountering a limitation with Microsoft.Extensions.FileSystemGlobbing where the evaluation order of include and exclude patterns does not work as expected. I would like to request an enhancement to allow includes and excludes to be evaluated in the order they are added to the Matcher.
Current Behavior
When setting up the Matcher with the following patterns:
Matcher m = new();
m.AddInclude("**/*");
m.AddExclude("ExcludeMe/**/*");
m.AddInclude("ExcludeMe/ButActuallyIncludeMe/**/*");
And executing it against the following directory structure:
(Does NOT include root/ExcludeMe/ButActuallyIncludeMe/hiEarth.txt)
Expected Behavior
I expect the output to be:
Expected Output:
root/helloWorld.txt
root/ExcludeMe/ButActuallyIncludeMe/hiEarth.txt
Suggested Improvement
To achieve the expected behavior, the Matcher should respect the order of operations for includes and excludes, allowing later includes to override earlier excludes. This would provide more intuitive control over file selection.
Description:
I am encountering a limitation with
Microsoft.Extensions.FileSystemGlobbing
where the evaluation order of include and exclude patterns does not work as expected. I would like to request an enhancement to allow includes and excludes to be evaluated in the order they are added to theMatcher
.Current Behavior
When setting up the
Matcher
with the following patterns:And executing it against the following directory structure:
Actual Output:
root/helloWorld.txt
root/ExcludeMe/ButActuallyIncludeMe/hiEarth.txt
)Expected Behavior
I expect the output to be:
Expected Output:
root/helloWorld.txt
root/ExcludeMe/ButActuallyIncludeMe/hiEarth.txt
Suggested Improvement
To achieve the expected behavior, the
Matcher
should respect the order of operations for includes and excludes, allowing later includes to override earlier excludes. This would provide more intuitive control over file selection.Originally posted by @Benjin in https://github.com/dotnet/runtime/issues/21362#issuecomment-1311106263