Open
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
WalkthroughThe PR implements the Changes
Sequence DiagramsequenceDiagram
actor User
participant Wrapper as gtr Wrapper<br/>(Bash/Zsh/Fish)
participant Git as git gtr
participant FS as Filesystem
participant Hooks as Post-cd Hooks
User->>Wrapper: gtr new my-feature --cd
Wrapper->>Wrapper: Strip --cd flag
Wrapper->>Git: git gtr new my-feature
Git->>FS: Create worktree
Git-->>Wrapper: Return success
Wrapper->>FS: Detect new directory<br/>(via worktree diff)
Wrapper->>Wrapper: Set env vars<br/>(WORKTREE_PATH, REPO_ROOT, BRANCH)
Wrapper->>Hooks: Load hooks from git config<br/>& .gtrconfig
Wrapper->>Hooks: Run post-cd hooks
Hooks-->>Wrapper: Hook results
Wrapper->>FS: Change to new directory
Wrapper-->>User: Ready in new worktree
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
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.
Description
Add
--cdto the shell integration generated bygit gtr init, sogtr new <branch> --cdcreates a worktree and lands in it.Motivation
Fixes #150.
The raw
git gtr newcommand cannot change the caller shell's current directory, so this keeps--cdout of the core CLI surface and implements it only in the shell wrapper.Type of Change
Testing
bats tests/gtr new plain --from HEAD --no-fetch --yeskeeps cwd unchangedgtr new demo --cd --from HEAD --no-fetch --yescds into the new worktree and runspostCdgtr new demo --cd --force --name backend --from HEAD --no-fetch --yesgtr new folder-branch --cd --folder alt --from HEAD --no-fetch --yesGTR_EDITOR_DEFAULT=true gtr new editor-demo --cd -e --from HEAD --no-fetch --yesGTR_AI_DEFAULT=true gtr new ai-demo --cd -a --from HEAD --no-fetch --yesNotes
postCdhooks now run aftergtr new --cdgit gtr newflag surface is unchangedSummary by CodeRabbit
New Features
--cdflag togtr newcommand, enabling creation and navigation to a new worktree in one stepgtr cdandgtr new --cdoperationsDocumentation
Tests
--cdfunctionality across supported shells