Enhance ignore logic in CollectURLsWithIgnoreConfig to include debug output for ignored paths. This change improves visibility into the URL collection process by logging paths that are ignored based on specified patterns, while also cleaning up redundant checks for ignored paths.

This commit is contained in:
Luke Hagar
2025-09-19 19:19:33 +00:00
parent f74fe031f2
commit 5ff8337397

View File

@@ -203,6 +203,14 @@ func CollectURLsWithIgnoreConfig(rootPath string, globs []string, respectGitigno
if err != nil {
return nil
}
if (ign != nil && ign.MatchesPath(path)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(path)) {
if isDebugEnv() {
fmt.Printf("::debug:: Ignoring path: %s\n", path)
}
return nil
}
rel, rerr := filepath.Rel(cleanRoot, path)
if rerr != nil {
rel = path
@@ -220,13 +228,6 @@ func CollectURLsWithIgnoreConfig(rootPath string, globs []string, respectGitigno
if filepath.Base(path) == ".slinkignore" || rel == ".slinkignore" || strings.HasSuffix(rel, "/.slinkignore") {
return nil
}
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
if isDebugEnv() {
fmt.Printf("::debug:: Ignoring file: %s\n", rel)
}
return nil
}
info, ierr := d.Info()
if ierr != nil {
return nil