Skip to content

fix(git): rewrite -C with quoted paths#2309

Open
fengjikui wants to merge 1 commit into
rtk-ai:developfrom
fengjikui:fix/hook-git-c-rewrite
Open

fix(git): rewrite -C with quoted paths#2309
fengjikui wants to merge 1 commit into
rtk-ai:developfrom
fengjikui:fix/hook-git-c-rewrite

Conversation

@fengjikui
Copy link
Copy Markdown

Summary

  • extend the git hook/discover rewrite pattern so git -C "path with spaces" <subcommand> routes through rtk git
  • keep the original quoted -C path in the rewritten command
  • add regression coverage for classification, rewrite, and global-option stripping

Context

Issue #2303 reports missed git -C <path> rewrites. Current develop already handles unquoted paths such as git -C /tmp status, but the same rewrite still missed valid quoted paths with spaces because the matcher only accepted \S+ values.

Before this change, the Claude hook produced no rewrite for:

git -C "/tmp/foo bar" status

After this change it rewrites to:

rtk git -C "/tmp/foo bar" status

Validation

  • cargo fmt --check
  • cargo test discover::registry::tests
  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • git diff --check
  • manual hook check with git -C "/tmp/foo bar" status

AI Assistance

This PR was prepared with OpenAI Codex assistance. I reviewed the diff and ran the validation above before submitting.

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.

1 participant