Skip to content

armgit / orca

Public Imported from GitHub
0

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.

683 B
Raw Blame
import type { BaseRefSearchResult } from './repo-types'

const LEGACY_REMOTE_REF_PREFIXES = ['origin/', 'upstream/']

export function deriveLegacyLocalBranchName(refName: string): string {
  // Older runtimes return display refs only; strip common remote prefixes so origin/feature/foo cannot become the local name.
  for (const prefix of LEGACY_REMOTE_REF_PREFIXES) {
    if (refName.startsWith(prefix) && refName.length > prefix.length) {
      return refName.slice(prefix.length)
    }
  }
  return refName
}

export function legacyBaseRefSearchResult(refName: string): BaseRefSearchResult {
  return {
    refName,
    localBranchName: deriveLegacyLocalBranchName(refName)
  }
}