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

Merged
sneak merged 2 commits from fix/issue-14 into next 2026-02-20 11:37:23 +01:00
Collaborator
No description provided.
sneak was assigned by clawbot 2026-02-08 21:06:22 +01:00
clawbot added 1 commit 2026-02-08 21:06:22 +01:00
path.Clean(".") returns "." which starts with a dot, causing IsHiddenPath
to incorrectly treat the current directory as hidden. Add explicit checks
for "." and "/" before the dot-prefix check.

Fixed in both mfer/scanner.go and internal/scanner/scanner.go.
Owner

fix conflict pls

fix conflict pls
clawbot force-pushed fix/issue-14 from e16c943296 to d6234d3d65 2026-02-09 02:12:53 +01:00 Compare
clawbot reviewed 2026-02-16 05:56:52 +01:00
clawbot left a comment
Author
Collaborator

Code Review: Fix IsHiddenPath treating current directory as hidden

Overall: LGTM -- clean, minimal fix.

What this does

Adds an early return in IsHiddenPath() for "." and "/" which path.Clean produces from inputs like "./", ".", etc. Without this, strings.HasPrefix(".", ".") incorrectly flags the current directory as hidden.

Review

  • Correct root cause fix. path.Clean(".") returns "." which then matches HasPrefix(".") -- the special-case check before the prefix test is the right approach.
  • Tests cover both cases ("." and "/"), with clear comments.
  • No side effects -- purely additive, no existing behavior changes for actual hidden paths.

One minor thought

The empty string case is implicitly handled: path.Clean("") returns ".", so an empty input now correctly returns false. Worth noting in a comment if you want, but not blocking.

Note on overlap with PR #21

PR #21 includes this same IsHiddenPath change (it needs it for the FindExtraFiles fix). Whichever merges second will need a trivial rebase. Consider merging PR #21 first since it is the superset, which would make this PR redundant.

Verdict: Good to merge.

## Code Review: Fix IsHiddenPath treating current directory as hidden **Overall: LGTM -- clean, minimal fix.** ### What this does Adds an early return in `IsHiddenPath()` for `"."` and `"/"` which `path.Clean` produces from inputs like `"./"`, `"."`, etc. Without this, `strings.HasPrefix(".", ".")` incorrectly flags the current directory as hidden. ### Review - **Correct root cause fix.** `path.Clean(".")` returns `"."` which then matches `HasPrefix(".")` -- the special-case check before the prefix test is the right approach. - **Tests cover both cases** (`"."` and `"/"`), with clear comments. - **No side effects** -- purely additive, no existing behavior changes for actual hidden paths. ### One minor thought The empty string case is implicitly handled: `path.Clean("")` returns `"."`, so an empty input now correctly returns `false`. Worth noting in a comment if you want, but not blocking. ### Note on overlap with PR #21 PR #21 includes this same `IsHiddenPath` change (it needs it for the `FindExtraFiles` fix). Whichever merges second will need a trivial rebase. Consider merging PR #21 first since it is the superset, which would make this PR redundant. **Verdict: Good to merge.**
clawbot reviewed 2026-02-16 05:58:11 +01:00
clawbot left a comment
Author
Collaborator

Blocker: No evidence of passing lint/tests

The PR does not mention whether go vet, staticcheck, or the full test suite (go test ./...) was run against these changes. Before merging, please confirm all linting and tests pass. Even though the change is small, IsHiddenPath is called in several code paths and regressions should be ruled out.

Holding approval until this is confirmed.

### Blocker: No evidence of passing lint/tests The PR does not mention whether `go vet`, `staticcheck`, or the full test suite (`go test ./...`) was run against these changes. Before merging, please confirm all linting and tests pass. Even though the change is small, `IsHiddenPath` is called in several code paths and regressions should be ruled out. Holding approval until this is confirmed.
Author
Collaborator

Code Review

Verdict: LGTM

Minimal, correct fix. path.Clean(".")" returns "." which then matched strings.HasPrefix(tp, ".")`, incorrectly marking the current directory as hidden. The early return for "." and "/" is the right fix.

Test cases added for both edge cases. Clean.

## Code Review **Verdict: LGTM ✅** Minimal, correct fix. `path.Clean(".")" returns "." which then matched `strings.HasPrefix(tp, ".")`, incorrectly marking the current directory as hidden. The early return for "." and "/" is the right fix. Test cases added for both edge cases. Clean.
clawbot force-pushed fix/issue-14 from d6234d3d65 to 8c7eef6240 2026-02-20 08:43:03 +01:00 Compare
Author
Collaborator

Rebased onto next, fixed pre-existing errcheck warnings in gpg.go/gpg_test.go, fixed gofmt alignment. All checks pass:

make test: PASS (all packages)
make lint: 0 issues, gofmt clean

Ready for review.

Rebased onto `next`, fixed pre-existing errcheck warnings in gpg.go/gpg_test.go, fixed gofmt alignment. All checks pass: ``` make test: PASS (all packages) make lint: 0 issues, gofmt clean ``` Ready for review.
clawbot added the
merge-ready
label 2026-02-20 09:17:21 +01:00
sneak merged commit 5099b6951b into next 2026-02-20 11:37:23 +01:00
Sign in to join this conversation.
No description provided.