diff options
| author | Timo Clasen <[email protected]> | 2025-09-17 16:46:18 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-09-17 09:46:18 -0500 |
| commit | 16f9edc1a01c01df951b3caeb0487e9476f60453 (patch) | |
| tree | 60fb9fa6c3a3970f9c746cf734654cb40712037f | |
| parent | 8c2aec43b800f0a460c31acf698e3a42b289162f (diff) | |
| download | opencode-16f9edc1a01c01df951b3caeb0487e9476f60453.tar.gz opencode-16f9edc1a01c01df951b3caeb0487e9476f60453.zip | |
fix(TUI): display correct branch name in git worktree (#2626)
| -rw-r--r-- | packages/tui/internal/components/status/status.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/packages/tui/internal/components/status/status.go b/packages/tui/internal/components/status/status.go index 9d2059e0e..aba80900b 100644 --- a/packages/tui/internal/components/status/status.go +++ b/packages/tui/internal/components/status/status.go @@ -200,7 +200,7 @@ func (m *statusComponent) View() string { func (m *statusComponent) startGitWatcher() tea.Cmd { cmd := util.CmdHandler( - GitBranchUpdatedMsg{Branch: getCurrentGitBranch(m.app.Project.Worktree)}, + GitBranchUpdatedMsg{Branch: getCurrentGitBranch(util.CwdPath)}, ) if err := m.initWatcher(); err != nil { return cmd @@ -209,7 +209,7 @@ func (m *statusComponent) startGitWatcher() tea.Cmd { } func (m *statusComponent) initWatcher() error { - gitDir := filepath.Join(m.app.Project.Worktree, ".git") + gitDir := filepath.Join(util.CwdPath, ".git") headFile := filepath.Join(gitDir, "HEAD") if info, err := os.Stat(gitDir); err != nil || !info.IsDir() { return err @@ -247,7 +247,7 @@ func (m *statusComponent) watchForGitChanges() tea.Cmd { for { select { case event, ok := <-m.watcher.Events: - branch := getCurrentGitBranch(m.app.Project.Worktree) + branch := getCurrentGitBranch(util.CwdPath) if !ok { return GitBranchUpdatedMsg{Branch: branch} } @@ -276,8 +276,8 @@ func (m *statusComponent) updateWatchedFiles() { if m.watcher == nil { return } - refFile := getGitRefFile(m.app.Project.Worktree) - headFile := filepath.Join(m.app.Project.Worktree, ".git", "HEAD") + refFile := getGitRefFile(util.CwdPath) + headFile := filepath.Join(util.CwdPath, ".git", "HEAD") if refFile != headFile && refFile != "" { if _, err := os.Stat(refFile); err == nil { // Try to add the new ref file (ignore error if already watching) |
