fix(worktrees): ignore generated pre-commit config#252
Conversation
git-worktree-remove-safe.sh checks ignored files before forcing submodule worktree removal. Generated .pre-commit-config.yaml is expected in clean worktrees and is recreated by the hook sync path, so it should not block cleanup. The filter is exact and leaves every other dirty, untracked, or ignored status line visible to the refusal path. Validation: - nix fmt on scripts/git-worktree-remove-safe.sh - bash -n scripts/git-worktree-remove-safe.sh - nix run nixpkgs#shellcheck on scripts/git-worktree-remove-safe.sh
|
Claude finished @Bad3r's task in 2m 34s —— View job ReviewNo issues found. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c07e5f4993
ℹ️ 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".
There was a problem hiding this comment.
Code Review
This pull request updates the require_clean_worktree function in scripts/git-worktree-remove-safe.sh to ignore the .pre-commit-config.yaml file when determining if a worktree is dirty. The review feedback points out that this exclusion should also be applied to submodule status checks to fully achieve the intended goal. Additionally, it is recommended to export LC_ALL=C to ensure consistent Git output parsing across different environments.
The cleanup helper ignored every porcelain status for `.pre-commit-config.yaml`. Worktrees with initialized submodules could pass the preflight check and then hit the fallback `git worktree remove --force` path. That could drop tracked edits reported as ` M .pre-commit-config.yaml` after 66ac9ba removed the tracked config. Keep the exemption limited to `!! .pre-commit-config.yaml` and apply the same filter inside submodule checks. Add a shell regression test for root ignored configs, tracked root edits with submodules, and ignored submodule configs. Validation: - nix fmt --accept-flake-config --no-write-lock-file -- \ scripts/git-worktree-remove-safe.sh tests/git-worktree-remove-safe/run.sh - bash -n scripts/git-worktree-remove-safe.sh \ tests/git-worktree-remove-safe/run.sh - bash tests/git-worktree-remove-safe/run.sh - nix run --accept-flake-config --no-write-lock-file nixpkgs#shellcheck -- \ scripts/git-worktree-remove-safe.sh tests/git-worktree-remove-safe/run.sh - git diff --check
|
Addressed the valid review feedback in commit ec41260. Accepted and implemented:
Rejected or already satisfied:
Reliability impact:
Validation run:
|
Summary
Test plan