Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.
TypeScript adeagent-ideai-agentsautomationbotclaude-codecodexghosttygrok-bothermes-agentmobile-appmuseopenclawopencodeorchestrationpiruntimeterminalworktreesyc-backed
export function splitRemoteBranchName(refName: string): {
remoteName: string
branchName: string
} | null {
const slashIndex = refName.indexOf('/')
if (slashIndex <= 0 || slashIndex === refName.length - 1) {
return null
}
return {
remoteName: refName.slice(0, slashIndex),
branchName: refName.slice(slashIndex + 1)
}
}
export function gitRefTargetsBranchName(
refName: string | null | undefined,
branchName: string
): boolean {
const trimmed = refName?.trim()
if (!trimmed || !branchName) {
return false
}
const headsPrefix = 'refs/heads/'
if (trimmed.startsWith(headsPrefix)) {
return trimmed.slice(headsPrefix.length) === branchName
}
const remotesPrefix = 'refs/remotes/'
if (trimmed.startsWith(remotesPrefix)) {
return splitRemoteBranchName(trimmed.slice(remotesPrefix.length))?.branchName === branchName
}
return trimmed === branchName || splitRemoteBranchName(trimmed)?.branchName === branchName
}
export function gitRefTargetsBranchOnRemote(
refName: string | null | undefined,
remoteName: string,
branchName: string
): boolean {
const trimmed = refName?.trim()
if (!trimmed || !remoteName || !branchName) {
return false
}
// Fork reviews may target fork/main instead of saved origin/main; match remote and branch together.
if (
trimmed === `${remoteName}/${branchName}` ||
trimmed === `remotes/${remoteName}/${branchName}` ||
trimmed === `refs/remotes/${remoteName}/${branchName}`
) {
return true
}
if (trimmed.startsWith('refs/remotes/') || trimmed.startsWith('remotes/')) {
return false
}
const headsPrefix = 'refs/heads/'
if (trimmed.startsWith(headsPrefix)) {
return trimmed.slice(headsPrefix.length) === branchName
}
return trimmed === branchName
}