fix(branch-picker): strip remote prefix when checking out remote branches

This commit is contained in:
xintaofei
2026-04-22 22:56:36 +08:00
parent 5ac9cee2ff
commit 7a03cfff36

View File

@@ -301,21 +301,28 @@ const BranchPicker = memo(function BranchPicker({
count: branchList.remote.length, count: branchList.remote.length,
})} })}
> >
{branchList.remote.map((b) => ( {branchList.remote.map((b) => {
<CommandItem const localName = b.replace(/^[^/]+\//, "")
key={`remote-${b}`} return (
value={`remote ${b}`} <CommandItem
onSelect={() => { key={`remote-${b}`}
setOpen(false) value={`remote ${b}`}
void onCheckout(b) onSelect={() => {
}} setOpen(false)
> if (localName !== currentBranch)
<GitBranch className="h-4 w-4 opacity-60" /> void onCheckout(localName)
<span className="flex-1 truncate text-muted-foreground"> }}
{b} >
</span> <GitBranch className="h-4 w-4 opacity-60" />
</CommandItem> <span className="flex-1 truncate text-muted-foreground">
))} {b}
</span>
{localName === currentBranch && (
<Check className="h-4 w-4 shrink-0" />
)}
</CommandItem>
)
})}
</CommandGroup> </CommandGroup>
)} )}
</> </>