mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-16 08:27:06 +08:00
vendor: update buildkit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
31
vendor/github.com/tonistiigi/fsutil/walker.go
generated
vendored
31
vendor/github.com/tonistiigi/fsutil/walker.go
generated
vendored
@ -62,7 +62,12 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err
|
||||
}
|
||||
}
|
||||
|
||||
var lastIncludedDir string
|
||||
var (
|
||||
lastIncludedDir string
|
||||
|
||||
parentDirs []string // used only for exclude handling
|
||||
parentMatchedExclude []bool
|
||||
)
|
||||
|
||||
seenFiles := make(map[uint64]string)
|
||||
return filepath.Walk(root, func(path string, fi os.FileInfo, err error) (retErr error) {
|
||||
@ -118,17 +123,37 @@ func Walk(ctx context.Context, p string, opt *WalkOpt, fn filepath.WalkFunc) err
|
||||
}
|
||||
}
|
||||
if pm != nil {
|
||||
m, err := pm.Matches(path)
|
||||
for len(parentMatchedExclude) != 0 {
|
||||
lastParentDir := parentDirs[len(parentDirs)-1]
|
||||
if strings.HasPrefix(path, lastParentDir) {
|
||||
break
|
||||
}
|
||||
parentDirs = parentDirs[:len(parentDirs)-1]
|
||||
parentMatchedExclude = parentMatchedExclude[:len(parentMatchedExclude)-1]
|
||||
}
|
||||
|
||||
var m bool
|
||||
if len(parentMatchedExclude) != 0 {
|
||||
m, err = pm.MatchesUsingParentResult(path, parentMatchedExclude[len(parentMatchedExclude)-1])
|
||||
} else {
|
||||
m, err = pm.MatchesOrParentMatches(path)
|
||||
}
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to match excludepatterns")
|
||||
}
|
||||
|
||||
var dirSlash string
|
||||
if fi.IsDir() {
|
||||
dirSlash = path + string(filepath.Separator)
|
||||
parentDirs = append(parentDirs, dirSlash)
|
||||
parentMatchedExclude = append(parentMatchedExclude, m)
|
||||
}
|
||||
|
||||
if m {
|
||||
if fi.IsDir() {
|
||||
if !pm.Exclusions() {
|
||||
return filepath.SkipDir
|
||||
}
|
||||
dirSlash := path + string(filepath.Separator)
|
||||
for _, pat := range pm.Patterns() {
|
||||
if !pat.Exclusion() {
|
||||
continue
|
||||
|
Reference in New Issue
Block a user