Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions compose/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,24 @@ var (
StrategyFilterPackage = "filter-package-files"
)

// return conflict const (0 - no warning, 1 - conflict with local, 2 conflict with pacakge)
// return conflict const (0 - no warning, 1 - conflict with local, 2 conflict with package)

func cleanStrategyPaths(paths []string) []string {
// remove trailing separators and add only one separator at the end.
// so prefix won't be greedy during comparison.
var r []string

for _, p := range paths {
path := filepath.Clean(p)
if !strings.HasSuffix(path, string(os.PathSeparator)) {
path += string(os.PathSeparator)
}

r = append(r, path)
}

return r
}

func retrieveStrategies(packages []*Package) ([]*mergeStrategy, map[string][]*mergeStrategy) {
var ls []*mergeStrategy
Expand All @@ -70,7 +87,7 @@ func retrieveStrategies(packages []*Package) ([]*mergeStrategy, map[string][]*me
if s == undefinedStrategy {
continue
}
strategy := &mergeStrategy{s, t, item.Paths}
strategy := &mergeStrategy{s, t, cleanStrategyPaths(item.Paths)}

if t == localStrategy {
ls = append(ls, strategy)
Expand Down
Loading