[PR #2626] fix(TUI): display correct branch name in git worktree #10382

Closed
opened 2026-02-16 18:15:01 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/2626

State: closed
Merged: Yes


Problem: When opening opencode in a git worktree, the TUI displays the branch name from the main worktree instead of the current worktree's branch.

Root Cause: The status component inconsistently used m.app.Project.Worktree (main worktree path from server) instead of util.CwdPath (actual current
working directory) for git operations.

Solution: Consistently use util.CwdPath for all git operations:

• Branch detection calls to getCurrentGitBranch()
• Git directory path construction
• File watcher setup for .git/HEAD and ref files

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2626 **State:** closed **Merged:** Yes --- Problem: When opening opencode in a git worktree, the TUI displays the branch name from the main worktree instead of the current worktree's branch. Root Cause: The status component inconsistently used `m.app.Project.Worktree` (main worktree path from server) instead of `util.CwdPath` (actual current working directory) for git operations. Solution: Consistently use `util.CwdPath` for all git operations: • Branch detection calls to getCurrentGitBranch() • Git directory path construction • File watcher setup for .git/HEAD and ref files
yindo added the pull-request label 2026-02-16 18:15:01 -05:00
yindo closed this issue 2026-02-16 18:15:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10382