Skip to content

Commit

Permalink
fix: sauceignore pattern matching on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
alexplischke committed Jul 15, 2024
1 parent aa63c9b commit f609519
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions internal/sauceignore/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ import (
func ExcludeSauceIgnorePatterns(files []string, sauceignoreFile string) []string {
matcher, err := NewMatcherFromFile(sauceignoreFile)
if err != nil {
log.Warn().Err(err).Msgf("An error occurred when filtering specs with %s. No filter will be applied", sauceignoreFile)
log.Warn().Err(err).Msgf(
"An error occurred when filtering specs with %s. No filter will be applied",
sauceignoreFile,
)
return files
}

var selectedFiles []string
for _, filename := range files {
if !matcher.Match(strings.Split(filename, string(filepath.Separator)), false) {
normalized := filepath.ToSlash(filename)
if !matcher.Match(strings.Split(normalized, "/"), false) {
selectedFiles = append(selectedFiles, filename)
}
}
Expand Down

0 comments on commit f609519

Please sign in to comment.