MCPcopy Index your code
hub / github.com/dagger/dagger / rebasePatterns

Function rebasePatterns

core/schema/modulesource.go:3540–3555  ·  view source on GitHub ↗
(patterns []string, base string)

Source from the content-addressed store, hash-verified

3538}
3539
3540func rebasePatterns(patterns []string, base string) ([]string, error) {
3541 rebased := make([]string, 0, len(patterns))
3542 for _, pattern := range patterns {
3543 isNegation := strings.HasPrefix(pattern, "!")
3544 pattern = strings.TrimPrefix(pattern, "!")
3545 relPath := filepath.Join(base, pattern)
3546 if !filepath.IsLocal(relPath) {
3547 return nil, fmt.Errorf("include/exclude path %q escapes context", relPath)
3548 }
3549 if isNegation {
3550 relPath = "!" + relPath
3551 }
3552 rebased = append(rebased, relPath)
3553 }
3554 return rebased, nil
3555}
3556
3557// Match a version string in a list of versions with optional subPath
3558// e.g. github.com/foo/daggerverse/mod@mod/v1.0.0

Callers 2

initFromModConfigMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected