diff --git a/utils/xfs/walk.go b/utils/xfs/walk.go index 31a621e2..9d35b8c5 100644 --- a/utils/xfs/walk.go +++ b/utils/xfs/walk.go @@ -2,12 +2,10 @@ package xfs import ( "context" - "errors" "fmt" "github.com/bmatcuk/doublestar/v4" "github.com/hephbuild/heph/utils/ads" "io/fs" - "os" "path/filepath" "strings" ) @@ -123,25 +121,11 @@ func starWalk(ctx context.Context, root, pattern string, ignore []string, fn fs. i := indexMeta(pattern) if i == -1 { - // Pattern is actually a pure path - path := unescapeMeta(pattern) - info, err := os.Lstat(path) - if err != nil { - if errors.Is(err, fs.ErrNotExist) { - return nil - } - return err - } - - if !info.IsDir() { - // It's not a directory, no need to walk - walkRoot = path - alwaysMatch = true - } - - // All files recursively in the dir would match + // Pattern is actually a pure path + // If dir: all files recursively would match + // If file: it will call fn once with the file alwaysMatch = true walkRoot = path } else if i > 0 {