From 377fdfb503ac03bd06ced582474a022868da83b7 Mon Sep 17 00:00:00 2001 From: user Date: Tue, 10 Feb 2026 18:33:41 -0800 Subject: [PATCH] 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". --- mfer/scanner.go | 3 +++ mfer/scanner_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/mfer/scanner.go b/mfer/scanner.go index df0df11..472ba4a 100644 --- a/mfer/scanner.go +++ b/mfer/scanner.go @@ -385,6 +385,9 @@ func (s *Scanner) ToManifest(ctx context.Context, w io.Writer, progress chan<- S // The path should use forward slashes. func IsHiddenPath(p string) bool { tp := path.Clean(p) + if tp == "." { + return false + } if strings.HasPrefix(tp, ".") { return true } diff --git a/mfer/scanner_test.go b/mfer/scanner_test.go index b6e6296..9a0a533 100644 --- a/mfer/scanner_test.go +++ b/mfer/scanner_test.go @@ -352,6 +352,9 @@ func TestIsHiddenPath(t *testing.T) { {"/absolute/.hidden", true}, {"./relative", false}, // path.Clean removes leading ./ {"a/b/c/.d/e", true}, + {".", false}, // current directory is not hidden (#14) + {"./", false}, // current directory with trailing slash + {"./file.txt", false}, // file in current directory } for _, tt := range tests {