Revert "Use IgnoreDuplicateDirs to prevent duplicate directory traversal"

This reverts commit 6f33df755e.
This commit is contained in:
Junegunn Choi
2026-03-18 18:57:40 +09:00
parent 6f33df755e
commit 2ae7367e8a
2 changed files with 2 additions and 9 deletions
+2 -8
View File
@@ -269,9 +269,7 @@ func trimPath(path string) string {
func (r *Reader) readFiles(roots []string, opts walkerOpts, ignores []string) bool {
conf := fastwalk.Config{
// When opts.follow is true, symlink following and loop/duplicate
// detection is handled by IgnoreDuplicateDirs below.
Follow: false,
Follow: opts.follow,
// Use forward slashes when running a Windows binary under WSL or MSYS
ToSlash: fastwalk.DefaultToSlash(),
Sort: fastwalk.SortFilesFirst,
@@ -341,13 +339,9 @@ func (r *Reader) readFiles(roots []string, opts walkerOpts, ignores []string) bo
}
return nil
}
var walkFn fs.WalkDirFunc = fn
if opts.follow {
walkFn = fastwalk.IgnoreDuplicateDirs(fn)
}
noerr := true
for _, root := range roots {
noerr = noerr && (fastwalk.Walk(&conf, root, walkFn) == nil)
noerr = noerr && (fastwalk.Walk(&conf, root, fn) == nil)
}
return noerr
}