fix: improve file ignore logic and preserve newlines in extracted content

This commit is contained in:
Arik Jones (aider)
2024-09-22 16:58:53 -05:00
parent 396f092d50
commit 59994c085c
2 changed files with 15 additions and 7 deletions

View File

@@ -87,11 +87,14 @@ func isIgnored(filePath string, patterns []string) bool {
return true
}
} else {
// Check if the pattern matches any part of the file path
// Check if the pattern matches the full path or any part of it
if matched, _ := filepath.Match(pattern, filePath); matched {
return true
}
pathParts := strings.Split(filePath, string(os.PathSeparator))
for _, part := range pathParts {
matched, err := filepath.Match(pattern, part)
if err == nil && matched {
for i := range pathParts {
partialPath := filepath.Join(pathParts[:i+1]...)
if matched, _ := filepath.Match(pattern, partialPath); matched {
return true
}
}