File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -64,19 +64,22 @@ public IEnumerable<FileInfo> Filter(IEnumerable<FileInfo> files)
64
64
pathFilters . Add ( new PathFilter ( new Regex ( regex , RegexOptions . IgnoreCase | RegexOptions . Compiled | RegexOptions . Singleline ) , include ) ) ;
65
65
}
66
66
67
+ var includeByDefault = pathFilters . All ( f => ! f . Include ) ;
67
68
var unfilteredResult = files . Select ( f =>
68
69
new
69
70
{
70
71
FileInfo = f ,
71
72
FileInclusion = new FileInclusion (
72
73
FileUtils . ConvertToUnix ( f . FullName . ToLowerInvariant ( ) ) . Replace ( rootFolder , string . Empty ) . TrimStart ( '/' ) ,
73
- pathFilters . All ( f => ! f . Include ) )
74
+ includeByDefault )
74
75
} ) ;
75
76
77
+ // Move included pathfilters to the front of the list:
78
+ pathFilters . Sort ( ( pf1 , pf2 ) => - 1 * pf1 . Include . CompareTo ( pf2 . Include ) ) ;
76
79
return unfilteredResult . Where ( f =>
77
80
{
78
81
var include = f . FileInclusion . Include ;
79
- foreach ( var pathFilter in pathFilters . OrderBy ( pf => pf . Include ? 0 : 1 ) )
82
+ foreach ( var pathFilter in pathFilters )
80
83
{
81
84
if ( pathFilter . Regex . IsMatch ( f . FileInclusion . Path ) )
82
85
{
You can’t perform that action at this time.
0 commit comments