Skip to content

fix: single-pass replace, exit status, and skip .git files#52

Open
leno23 wants to merge 1 commit into
dolph:mainfrom
leno23:fix/single-scan-exit-status-skip-git-file
Open

fix: single-pass replace, exit status, and skip .git files#52
leno23 wants to merge 1 commit into
dolph:mainfrom
leno23:fix/single-scan-exit-status-skip-git-file

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

Test plan

  • go test ./...
  • TestHandleFileSkipsGitFile

Closes #11, #14, and #19

Made with Cursor

- Replace file contents in one pass (drop redundant Contains scan).
- Record directory read failures and exit non-zero from main.
- Skip .git entries whether they are directories or worktree files.

Addresses dolph#11, dolph#14, and dolph#19.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread find_replace.go
Comment on lines 70 to +72
if err != nil {
log.Fatalf("Unable to read directory: %v", err)
fr.noteError("Unable to read directory: %v", err)
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Process exits 0 even when individual files failed to rewrite or rename

1 participant