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)
6464 pathFilters . Add ( new PathFilter ( new Regex ( regex , RegexOptions . IgnoreCase | RegexOptions . Compiled | RegexOptions . Singleline ) , include ) ) ;
6565 }
6666
67+ var includeByDefault = pathFilters . All ( f => ! f . Include ) ;
6768 var unfilteredResult = files . Select ( f =>
6869 new
6970 {
7071 FileInfo = f ,
7172 FileInclusion = new FileInclusion (
7273 FileUtils . ConvertToUnix ( f . FullName . ToLowerInvariant ( ) ) . Replace ( rootFolder , string . Empty ) . TrimStart ( '/' ) ,
73- pathFilters . All ( f => ! f . Include ) )
74+ includeByDefault )
7475 } ) ;
7576
77+ // Move included pathfilters to the front of the list:
78+ pathFilters . Sort ( ( pf1 , pf2 ) => - 1 * pf1 . Include . CompareTo ( pf2 . Include ) ) ;
7679 return unfilteredResult . Where ( f =>
7780 {
7881 var include = f . FileInclusion . Include ;
79- foreach ( var pathFilter in pathFilters . OrderBy ( pf => pf . Include ? 0 : 1 ) )
82+ foreach ( var pathFilter in pathFilters )
8083 {
8184 if ( pathFilter . Regex . IsMatch ( f . FileInclusion . Path ) )
8285 {
You can’t perform that action at this time.
0 commit comments