fix(branch-picker): strip remote prefix when checking out remote branches
This commit is contained in:
@@ -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) => {
|
||||||
|
const localName = b.replace(/^[^/]+\//, "")
|
||||||
|
return (
|
||||||
<CommandItem
|
<CommandItem
|
||||||
key={`remote-${b}`}
|
key={`remote-${b}`}
|
||||||
value={`remote ${b}`}
|
value={`remote ${b}`}
|
||||||
onSelect={() => {
|
onSelect={() => {
|
||||||
setOpen(false)
|
setOpen(false)
|
||||||
void onCheckout(b)
|
if (localName !== currentBranch)
|
||||||
|
void onCheckout(localName)
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<GitBranch className="h-4 w-4 opacity-60" />
|
<GitBranch className="h-4 w-4 opacity-60" />
|
||||||
<span className="flex-1 truncate text-muted-foreground">
|
<span className="flex-1 truncate text-muted-foreground">
|
||||||
{b}
|
{b}
|
||||||
</span>
|
</span>
|
||||||
|
{localName === currentBranch && (
|
||||||
|
<Check className="h-4 w-4 shrink-0" />
|
||||||
|
)}
|
||||||
</CommandItem>
|
</CommandItem>
|
||||||
))}
|
)
|
||||||
|
})}
|
||||||
</CommandGroup>
|
</CommandGroup>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user