walker: Do not treat '..' as a hidden entry

Thanks to @LangLangBart for the suggested fix

Fix #4048
This commit is contained in:
Junegunn Choi 2024-10-25 13:50:15 +09:00
parent 3c40b1bd51
commit d65c6101a8
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627

View File

@ -265,7 +265,7 @@ func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool
isDir := de.IsDir()
if isDir || opts.follow && isSymlinkToDir(path, de) {
base := filepath.Base(path)
if !opts.hidden && base[0] == '.' {
if !opts.hidden && base[0] == '.' && base != ".." {
return filepath.SkipDir
}
for _, ignore := range ignores {