Skip to content

Commit

Permalink
Fix ignore on Windows
Browse files Browse the repository at this point in the history
`fileMatches` will receive paths with native path separators(i.e. `\` on Windows). Per the [doc](https://github.com/bmatcuk/doublestar/tree/v4?tab=readme-ov-file#match) `doublestar.Match` doesn't work as expected with `\`, and `filepath.ToSlash()` should be used to handle such case.
  • Loading branch information
06393993 committed Jul 8, 2024
1 parent 4caba19 commit 688c4eb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ func walk(ch chan<- *file, start string) error {
// fileMatches determines if path matches one of the provided file patterns.
// Patterns are assumed to be valid.
func fileMatches(path string, patterns []string) bool {
// handle both \ and /
path = filepath.ToSlash(path)
for _, p := range patterns {
// ignore error, since we assume patterns are valid
if match, _ := doublestar.Match(p, path); match {
Expand Down

0 comments on commit 688c4eb

Please sign in to comment.