Support remote branch listing and tracked checkout from branch picker#126
Support remote branch listing and tracked checkout from branch picker#126juliusmarminge merged 7 commits intomainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
- Include remote refs in branch listings, ordered after local branches - Auto-track remote branches on checkout when no local branch exists - Update branch picker to label remote branches and store local branch name after checkout
91d3f5f to
4b83e28
Compare
- Deduplicate branch list by removing remote refs that match an existing local branch - Move remote-ref local-name derivation into shared BranchToolbar logic - Add logic tests for remote-ref parsing and deduplication behavior
- Move PR status indicator into the main thread info row - Keep thread status badge and title grouped for consistent alignment
- add `remoteName` to git branch contract metadata - resolve remote refs using full remote names (including slashes) - avoid fallback to wrong local checkout when remote ref is missing - update branch toolbar logic/tests to map and dedupe remote branches correctly
- ignore branch lines starting with `(` when parsing `git branch` output - add integration test to verify detached HEAD does not appear as a branch
- Fall back to empty remote branch and remote name data when git remote queries fail - Log warnings instead of failing `listBranches` - Add integration test covering remote lookup failure fallback
- fall back to plain checkout (detached HEAD) when `--track` would clash with an existing local branch - add GitCore coverage for the conflict fallback path - simplify branch-name derivation in BranchToolbar to consistently strip the first remote segment
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is ON, but it could not run because the spend limit has been reached. To enable Bugbot Autofix, raise your spend limit in the Cursor dashboard.
| return branchName; | ||
| } | ||
| return branchName.slice(firstSeparatorIndex + 1); | ||
| } |
There was a problem hiding this comment.
Duplicate function with divergent return type semantics
Low Severity
deriveLocalBranchNameFromRemoteRef exists in both GitCore.ts and BranchToolbar.logic.ts with the same name and core logic but different return-type contracts: the server version returns string | null for malformed input, while the client version returns the original branchName. This divergence creates a maintenance trap — a future developer modifying one copy may not realize the other exists or behaves differently for edge cases.


Summary
refs/remotesalongside local branches.isRemote, exclude symbolic refs (for exampleorigin/HEAD -> origin/main), and keep local branches listed before remotes.git checkout --track <remote>/<branch>fallback flow).remotebadge, and set thread state to the derived local branch name after remote checkout.Testing
apps/server/src/git/Layers/GitCore.test.ts: added integration test validating local-first/remote-last ordering and remote-only branch inclusion.Note
Medium Risk
Touches core Git branch listing/checkout behavior and expands the shared
GitBranchcontract, which can affect branch selection and checkout flows across clients. Adds fallbacks and tests, but edge cases around remotes/tracking and naming could still cause unexpected checkouts or UI state mismatches.Overview
Extends server-side branch listing to include remote branches alongside locals, filtering out symbolic refs and detached-HEAD pseudo-refs, adding
isRemote/remoteNamemetadata (including remotes with slashes), sorting locals before remotes, and falling back to empty remote data when remote lookups fail.Updates checkout to better handle remote refs by detecting whether a ref exists locally/remotely, checking out an existing tracking branch when present, using
--trackwhen safe, and avoiding silent local-branch checkouts when a remote ref is missing (with a detached fallback when tracking would conflict).Wires the branch picker UI to display/dedupe remote refs, show a
remotebadge, and after remote checkout set thread state to the derived/actual checked-out local branch; updates tests on both server and web to cover these remote and edge-case behaviors.Written by Cursor Bugbot for commit 7a897e9. This will update automatically on new commits. Configure here.
Note
Support remote branch listing and tracked checkout in the branch picker by reworking
GitCore.listBranchesandGitCore.checkoutBranchin GitCore.tsAdd remote-aware branch listing with
isRemoteandremoteName, exclude symbolic and detached refs, sort by recency, and implement tracked checkout resolution including remotes with slashes. Update web branch picker to dedupe remote refs with local matches and show a remote badge. Extendgit.GitBranchschema to carry remote metadata.📍Where to Start
Start with
GitCore.listBranchesandGitCore.checkoutBranchin GitCore.ts.Macroscope summarized 7a897e9.