Skip to content
Myr

--walker-skip should also handle symlinks to directories

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fix #3858

authored by Junegunn Choi · committed by Junegunn Choi · parent 0acace1 · Browse files · 1 file+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−1 removed

  • other:+12 added−1 removed

1 file+12 added−1 removed

modified:src/reader.go+12 added-1 removed
2 unmodified lines
3import (4 "bytes"5 "context"6 "io"7 "io/fs"8 "os"9 "os/exec"10 "path/filepath"11 "sync"
210 unmodified lines
222 r.feed(os.Stdin)223 return true224}225226func isSymlinkToDir(path string, de os.DirEntry) bool {227 if de.Type()&fs.ModeSymlink == 0 {228 return false229 }230 if s, err := os.Stat(path); err == nil {231 return s.IsDir()232 }233 return false234}235236func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool {237 r.killed = false238 conf := fastwalk.Config{Follow: opts.follow}239 fn := func(path string, de os.DirEntry, err error) error {
2 unmodified lines
242 }243 path = filepath.Clean(path)244 if path != "." {245 isDir := de.IsDir()235 if isDir {246 if isDir || opts.follow && isSymlinkToDir(path, de) {247 base := filepath.Base(path)248 if !opts.hidden && base[0] == '.' {249 return filepath.SkipDir250 }
48 unmodified lines