feat: support git -C <path> flag for cross-directory operations#171
Open
pcadet wants to merge 2 commits intortk-ai:masterfrom
Open
feat: support git -C <path> flag for cross-directory operations#171pcadet wants to merge 2 commits intortk-ai:masterfrom
pcadet wants to merge 2 commits intortk-ai:masterfrom
Conversation
Add support for the git global flag -C <path> which allows running git commands in a different directory. This is commonly used by Claude Code when working across multiple repositories. Changes: - main.rs: Add -C option to Git command variant, pass to git module - git.rs: Add git_command() helper that prepends -C <path>, thread git_dir parameter through all run_* functions - rtk-rewrite.sh: Extract -C flags before subcommand matching, inject them into rewritten commands via _rtk_git_rewrite() helper
Add PR rtk-ai#171 feature to CLAUDE.md (implementation details + fork-specific features), README.md (usage example), and CHANGELOG.md (release entry).
Collaborator
|
Thanks for this clean PR! The approach is solid — A few notes: Code looks good:
Minor requests before merge:
Question: Does this handle Overall this is mergeable with the doc changes removed. Nice work! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-C <path>flag support tortk gitcommands, enabling cross-directory git operationsgit_command()helper that prepends-C <path>to all git invocationsgit_dirparameter through all 12run_*functions ingit.rs-Cflags before subcommand matching via_rtk_git_rewrite()helperTest plan
cargo fmt && cargo clippy && cargo test— 362/362 pass, no new warningstest_git_command_with_dirandtest_git_command_without_dirgit -C /tmp/repo status→rtk git -C /tmp/repo statusgit -C /other/repo log --oneline -5→rtk git -C /other/repo log --oneline -5git status→rtk git status(unchanged)git diff --cached→rtk git diff --cached(unchanged)cargo test→rtk cargo test(non-git unaffected)rtk git -C /tmp status→ "Not a git repository" (correct)rtk git -C <real-repo> status→ filtered status outputrtk git status/rtk git log→ unchanged behavior (no regression)