mirror of
https://github.com/LukeHagar/slinky.git
synced 2025-12-06 04:21:20 +00:00
Add debug logging for ignored files and .slinkignore detection in fsurls.go
Enhance the CollectURLs and CollectURLsProgress functions to include debug output when files are ignored based on ignore patterns. Additionally, add debug statements to log the detection of .slinkignore files and the compilation of ignore patterns. This change improves traceability during URL collection and helps in debugging ignore logic.
This commit is contained in:
@@ -115,6 +115,9 @@ func CollectURLs(rootPath string, globs []string, respectGitignore bool) (map[st
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
|
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
|
||||||
|
if isDebugEnv() {
|
||||||
|
fmt.Printf("::debug:: Ignoring file: %s\n", rel)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
info, ierr := d.Info()
|
info, ierr := d.Info()
|
||||||
@@ -260,6 +263,9 @@ func CollectURLsProgress(rootPath string, globs []string, respectGitignore bool,
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
|
if (ign != nil && ign.MatchesPath(rel)) || (slPathIgnore != nil && slPathIgnore.MatchesPath(rel)) {
|
||||||
|
if isDebugEnv() {
|
||||||
|
fmt.Printf("::debug:: Ignoring file: %s\n", rel)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
info, ierr := d.Info()
|
info, ierr := d.Info()
|
||||||
@@ -680,7 +686,13 @@ func loadSlinkyIgnore(root string) (*ignore.GitIgnore, []string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if isDebugEnv() {
|
||||||
|
fmt.Printf("::debug:: Compiled ignore patterns: %v\n", lines)
|
||||||
|
}
|
||||||
ign = ignore.CompileIgnoreLines(lines...)
|
ign = ignore.CompileIgnoreLines(lines...)
|
||||||
|
if isDebugEnv() {
|
||||||
|
fmt.Printf("::debug:: Ignore matcher created successfully\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
var urlPatterns []string
|
var urlPatterns []string
|
||||||
for _, p := range cfg.IgnoreURLs {
|
for _, p := range cfg.IgnoreURLs {
|
||||||
@@ -698,6 +710,9 @@ func findSlinkyConfig(root string) string {
|
|||||||
for {
|
for {
|
||||||
cfg := filepath.Join(cur, ".slinkignore")
|
cfg := filepath.Join(cur, ".slinkignore")
|
||||||
if st, err := os.Stat(cfg); err == nil && !st.IsDir() {
|
if st, err := os.Stat(cfg); err == nil && !st.IsDir() {
|
||||||
|
if isDebugEnv() {
|
||||||
|
fmt.Printf("::debug:: Found .slinkignore at: %s\n", cfg)
|
||||||
|
}
|
||||||
return cfg
|
return cfg
|
||||||
}
|
}
|
||||||
parent := filepath.Dir(cur)
|
parent := filepath.Dir(cur)
|
||||||
@@ -706,6 +721,9 @@ func findSlinkyConfig(root string) string {
|
|||||||
}
|
}
|
||||||
cur = parent
|
cur = parent
|
||||||
}
|
}
|
||||||
|
if isDebugEnv() {
|
||||||
|
fmt.Printf("::debug:: No .slinkignore file found starting from: %s\n", root)
|
||||||
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user