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

Function validateBranch

packages/core/src/repository.ts:105–111  ·  view source on GitHub ↗
(branch: string)

Source from the content-addressed store, hash-verified

103}
104
105export function validateBranch(branch: string): void {
106 if (/^[A-Za-z0-9/_.-]+$/.test(branch) && !branch.startsWith("-") && !branch.includes("..")) return
107 throw new InvalidBranchError({
108 branch,
109 message: "Branch must contain only alphanumeric characters, /, _, ., and -, and cannot start with - or contain ..",
110 })
111}
112
113export function isFile(reference: Reference): reference is FileReference {
114 return reference.protocol === "file:"

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected