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

Thanks to @LangLangBart for the suggested fix

Fix #4048
This commit is contained in:
Junegunn Choi committed 2024-10-25 13:50:58 +09:00
1 parent 3c40b1bd51
commit d65c6101a8
1 file changed
+1 -1
+1 -1
View File
@@ -265,7 +265,7 @@ func (r *Reader) readFiles(root string, opts walkerOpts, ignores []string) bool
isDir := de.IsDir() isDir := de.IsDir()
if isDir || opts.follow && isSymlinkToDir(path, de) { if isDir || opts.follow && isSymlinkToDir(path, de) {
base := filepath.Base(path) base := filepath.Base(path)
if !opts.hidden && base[0] == '.' { if !opts.hidden && base[0] == '.' && base != ".." {
return filepath.SkipDir return filepath.SkipDir
} }
for _, ignore := range ignores { for _, ignore := range ignores {