Fix IsHiddenPath treating current directory as hidden (closes #14)

IsHiddenPath(".") incorrectly returned true because path.Clean(".")
starts with a dot. Add explicit check for "." before the HasPrefix
check. Add test cases for ".", "./", and "./file.txt".
This commit is contained in:
user 2026-02-10 18:33:41 -08:00 committed by clawbot
parent 6d1bdbb00f
commit c8381792cf

View File

@ -352,8 +352,10 @@ func TestIsHiddenPath(t *testing.T) {
{"/absolute/.hidden", true}, {"/absolute/.hidden", true},
{"./relative", false}, // path.Clean removes leading ./ {"./relative", false}, // path.Clean removes leading ./
{"a/b/c/.d/e", true}, {"a/b/c/.d/e", true},
{".", false}, // current directory is not hidden {".", false}, // current directory is not hidden (#14)
{"/", false}, // root is not hidden {"/", false}, // root is not hidden
{"./", false}, // current directory with trailing slash
{"./file.txt", false}, // file in current directory
} }
for _, tt := range tests { for _, tt := range tests {