From 396f092d50ed1ac415208183eef9f91fd5342231 Mon Sep 17 00:00:00 2001 From: "Arik Jones (aider)" Date: Sun, 22 Sep 2024 16:58:22 -0500 Subject: [PATCH] fix: improve file ignore pattern matching for nested directories --- cmd/files.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/files.go b/cmd/files.go index 1c10e4f..a0d49d1 100644 --- a/cmd/files.go +++ b/cmd/files.go @@ -87,9 +87,13 @@ func isIgnored(filePath string, patterns []string) bool { return true } } else { - matched, err := filepath.Match(pattern, filepath.Base(filePath)) - if err == nil && matched { - return true + // Check if the pattern matches any part of the file path + pathParts := strings.Split(filePath, string(os.PathSeparator)) + for _, part := range pathParts { + matched, err := filepath.Match(pattern, part) + if err == nil && matched { + return true + } } } }