You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: listRefs marks every branch isDefault: false when the primary remote is not named origin #42166
In a Git repository whose primary remote is not named origin (for example, cloned with git clone -o upstream ..., renamed via git remote rename origin upstream, or using a nested remote name like team/origin), GitVcsDriver.listRefs returns isDefault: false for every local and remote branch.
As a result:
listRefs does not pin the default branch ahead of newer non-default branches.
The branch picker (web, desktop, and mobile) fails to badge or pick the default branch for new threads/worktrees (BranchToolbar.logic.ts, BranchPicker.tsx, GitBranchesSheet.tsx, NewTaskDraftScreen.tsx).
t3_worktree_list reports isDefault: false on every branch.
Meanwhile, statusDetailsLocal / statusDetailsRemote in the same file already detect the default branch correctly via resolvePrimaryDefaultBranchName.
Root cause
In apps/server/src/vcs/GitVcsDriverCore.ts (readGitRefsSnapshot), default-branch detection hardcodes "origin" in three places instead of using the primary remote ("origin" when present, otherwise the first remote in Git order):
Queries refs/remotes/origin/HEAD directly via rev-parse (even though the for-each-ref call in the same function already emits %(symref) for all refs/remotes/*/HEAD entries).
Marks remote branches with parsedRemoteRef?.remoteName === "origin" && parsedRemoteRef.branchName === defaultBranch.
Steps to reproduce
Create a repo with a bare remote added as upstream (no origin), default branch trunk, and refs/remotes/upstream/HEAD -> refs/remotes/upstream/trunk.
Create a newer branch other, switch to feature, and call listRefs({ cwd, includeMatchingRemoteRefs: true }).
Actual:defaultBranch is null; both trunk and upstream/trunk have isDefault: false, and other sorts ahead of trunk.
Expected:trunk and upstream/trunk have isDefault: true, and trunk sorts ahead of other (matching statusDetailsLocal / statusDetailsRemote). When origin is configured without refs/remotes/origin/HEAD, defaultBranch should remain null (matching resolvePrimaryDefaultBranchName).
Activity