Skip to content

feat(desktop): add branch switcher dropdown in changes panel#3482

Closed
ttmouse wants to merge 2 commits into
esengine:main-v2from
ttmouse:feat/branch-switcher
Closed

feat(desktop): add branch switcher dropdown in changes panel#3482
ttmouse wants to merge 2 commits into
esengine:main-v2from
ttmouse:feat/branch-switcher

Conversation

@ttmouse

@ttmouse ttmouse commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Show the current Git branch name in the Changed-files view with a dropdown to switch branches and a refresh button to reload changes.

Backend

  • Add GitBranch field to WorkspaceChangesView struct
  • Add workspaceGitBranch() helper (supports named branch and detached HEAD)
  • Add GitBranches() and GitCheckout() app bindings

Frontend

  • WorkspacePanel: branch indicator bar with branch name button, dropdown menu listing all local branches, and a refresh button with spinning animation
  • Types: add gitBranch?: string to WorkspaceChangesView
  • Bridge: add GitBranches() and GitCheckout() to AppBindings + mock implementations
  • CSS: .workspace-branch-indicator, .workspace-branch-menu (with background, border, shadow), .workspace-branch-refresh with spin animation

Tests

  • Assert GitBranch in existing TestWorkspaceChangesGitStatus
  • Add TestWorkspaceChangesGitBranchDetachedHead for detached HEAD scenario
  • Add gitOutput() test helper

Verification

  • Go build passes
  • TypeScript compilation passes
  • wails build succeeds (darwin/arm64)
  • Branch dropdown renders with correct background, border, shadow, and adequate height

ttmouse added 2 commits June 8, 2026 03:32
Show current git branch name in the Changed-files view with a dropdown
to switch branches and a refresh button to reload changes.

Backend:
- Add GitBranch field to WorkspaceChangesView
- Add workspaceGitBranch() helper
- Add GitBranches() and GitCheckout() bindings

Frontend:
- Add branch indicator bar with dropdown menu
- Add refresh button with spinning animation
- Add workspace-branch CSS styles
- Add mock implementations for GitBranches/GitCheckout
- Update WorkspaceChangesView type with gitBranch field

Tests:
- Add GitBranch assertion to existing git status test
- Add TestWorkspaceChangesGitBranchDetachedHead
- Add gitOutput test helper
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4104b4b3e6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +273 to +274
} catch {
// Error message shown via the changes view

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface checkout failures to the user

When git checkout fails, for example because the current worktree has uncommitted changes that would be overwritten by the target branch, this catch block swallows the error and the loadChanges() call is skipped. The menu then closes in finally with the branch unchanged and no message in the changes view, so users cannot tell why the switch did not happen.

Useful? React with 👍 / 👎.

border: 1px solid var(--border);
border-radius: 6px;
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
overflow: hidden;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Let long branch lists scroll

For repositories with enough local branches to exceed the 300px cap, the popover is clipped because the outer menu has max-height plus overflow: hidden, while the intended scroll container (.workspace-branch-menu__inner) has no constrained height. The inner element expands to its full content height, so no scrollbar is created and lower branches become unreachable.

Useful? React with 👍 / 👎.

setSwitchingBranch(true);
try {
await app.GitCheckout(branch);
await loadChanges();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Refresh workspace files after checkout

After a successful branch switch this only reloads the changed-files view, but the file browser is backed by the cached entriesByDir tree and selected preview state, which are not invalidated here. If the target branch adds, removes, or changes files, switching back to the Files tab can show stale entries/previews from the previous branch until the user manually refreshes.

Useful? React with 👍 / 👎.

@SivanCola

Copy link
Copy Markdown
Collaborator

Please first fix the issues reported by the bot above. Also, kindly attach the screenshots of the code running results. Thank you.

@esengine esengine left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch indicator + switcher in the changes panel. exec.Command (no shell injection), dirty-tree checkout failures surface git's own error rather than silently dropping changes. Suggest a follow-up to reject branch args starting with '-'.

esengine added a commit that referenced this pull request Jun 8, 2026
* feat(desktop): add branch switcher dropdown in changes panel

Show current git branch name in the Changed-files view with a dropdown
to switch branches and a refresh button to reload changes.

Backend:
- Add GitBranch field to WorkspaceChangesView
- Add workspaceGitBranch() helper
- Add GitBranches() and GitCheckout() bindings

Frontend:
- Add branch indicator bar with dropdown menu
- Add refresh button with spinning animation
- Add workspace-branch CSS styles
- Add mock implementations for GitBranches/GitCheckout
- Update WorkspaceChangesView type with gitBranch field

Tests:
- Add GitBranch assertion to existing git status test
- Add TestWorkspaceChangesGitBranchDetachedHead
- Add gitOutput test helper

* fix(desktop): branch menu add background and increase height

---------

Co-authored-by: ttmouse <ttmouseg@gmail.com>
Co-authored-by: reasonix <reasonix@deepseek.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants