fix: silence branch track output in auto mode#33
Conversation
Changes:\n- redirect git branch --track stdout/stderr to /dev/null when auto-creating a local tracking branch\n- prevent WORKTREE_PATH pollution that broke postCreate hooks\n\nImpact:\n- only affects track_mode=auto with remote-only branches
WalkthroughThe change modifies output redirection for Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (5)lib/**/*.sh📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.sh📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{bash,fish,sh}📄 CodeRabbit inference engine (.github/instructions/sh.instructions.md)
Files:
{bin/gtr,lib/**/*.sh,adapters/**/*.sh}📄 CodeRabbit inference engine (.github/instructions/testing.instructions.md)
Files:
lib/*.sh📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description
Silence
git branch --trackoutput in auto mode socreate_worktreereturns only the worktree path.Motivation
In
track_mode=autowith a remote-only branch, git branch --trackprinted to stdout, which was concatenated into WORKTREE_PATH; postCreate hooks then failed when cd "$WORKTREE_PATH"was interpreted as cd Branch ...; this change keeps stdout clean by discarding the tracking command output.Fixes #32
Type of Change
Testing
Manual Testing Checklist
Tested on:
Core functionality tested:
git gtr new <branch>- Create worktreegit gtr go <branch>- Navigate to worktreegit gtr editor <branch>- Open in editor (if applicable)git gtr ai <branch>- Start AI tool (if applicable)git gtr rm <branch>- Remove worktreegit gtr list- List worktreesgit gtr config- Configuration commands (if applicable)Test Steps
git gtr new <branch>(track_mode=auto);WORKTREE_PATHequals the created worktree path with no extra textcd "$WORKTREE_PATH"; it succeeds.Expected behavior:
create_worktreestdout is just the worktree path; hooks cancdsuccessfully.Actual behavior:
Matches expected after the change.
Breaking Changes
Checklist
Before submitting this PR, please check:
git gtr(production) and./bin/gtr(development)Additional Context
License Acknowledgment
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache License 2.0.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.