fix: single-pass replace, exit status, and skip .git files#52
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a451402172
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if err != nil { | ||
| log.Fatalf("Unable to read directory: %v", err) | ||
| fr.noteError("Unable to read directory: %v", err) | ||
| return |
There was a problem hiding this comment.
Skip renaming directories when traversal fails
If os.ReadDir fails, WalkDir now logs and returns, but HandleFile still proceeds to RenameFile for that same directory. In permission-restricted trees (e.g., directory not readable but parent writable), this can rename a directory whose contents were never processed, leaving a partially transformed tree while only reporting a non-fatal error. Propagate traversal failure back to HandleFile (or gate rename on success) so unreadable subtrees are not renamed.
Useful? React with 👍 / 👎.
Summary
strings.Replaceonly when output differs).noteErrorand exit non-zero frommain(partial; per-file fatals unchanged until log.Fatal from worker goroutines leaves the tree in a partially-modified state #6)..git, including worktree pointer files.Test plan
go test ./...TestHandleFileSkipsGitFileCloses #11, #14, and #19
Made with Cursor