kbuntrock commented on code in PR #91:
URL: 
https://github.com/apache/maven-build-cache-extension/pull/91#discussion_r1315087882


##########
src/main/java/org/apache/maven/buildcache/checksum/MavenProjectInput.java:
##########
@@ -633,13 +714,7 @@ private static boolean isReadable(Path entry) throws 
IOException {
     }
 
     private boolean isFilteredOutSubpath(Path path) {
-        Path normalized = path.normalize();
-        for (Path filteredOutDir : filteredOutPaths) {
-            if (normalized.startsWith(filteredOutDir)) {
-                return true;
-            }
-        }
-        return false;
+        return inputExcludeDirectoryPathMatchers.stream().anyMatch(matcher -> 
matcher.stopTreeWalking(path));

Review Comment:
   Actually my goal was too keep the subtree exclusion with this syntax : if a 
directory is explicitly targeted by a glob, seems normal to me that the full 
subtree is excluded.  First of all : is this assumption shared? I guess 
probably not :p
   
   Secondly : have you tried this syntax or your comment is based on my current 
documentation? I have documented only the "best" syntax because there is a 
subtlety : this syntax does not work if the exclude directory is a parent of 
the include directory.
   
   Example 1 : 
   - input is : "src/main/generated"
   - exclude "src/main/generated/java" or "src/main/generated/java/**" are 
equivalent; everything in this folder is excluded
   
   Example 2 : 
   - input is "src/main/generated/java"
   - exclude "src/main/generated" : exclude nothing, exploring the file tree 
starts too low
   - exclude "src/main/generated/**" : exclude everything read in the 
"src/main/generated/java" folder
   
   I wasn't planning to explicitly describe this subtlety in the documentation 
since it looks more like a configuration mistake for me. But I'm promoting the 
best syntax.
   
   
    



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to