MCPcopy Create free account
hub / github.com/anomalyco/opencode / validateRepositoryBranch

Function validateRepositoryBranch

packages/opencode/src/util/repository.ts:203–211  ·  view source on GitHub ↗
(branch: string)

Source from the content-addressed store, hash-verified

201}
202
203export function validateRepositoryBranch(branch: string) {
204 if (!/^[A-Za-z0-9/_.-]+$/.test(branch) || branch.startsWith("-") || branch.includes("..")) {
205 throw new InvalidRepositoryBranchError({
206 branch,
207 message:
208 "Branch must contain only alphanumeric characters, /, _, ., and -, and cannot start with - or contain ..",
209 })
210 }
211}
212
213export function parseGitHubRemote(input: string) {
214 const cleaned = normalizeRepositoryInput(input)

Callers 1

repository.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected