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

Function splitGitPatch

packages/opencode/src/project/vcs.ts:88–95  ·  view source on GitHub ↗
(patch: Git.Patch)

Source from the content-addressed store, hash-verified

86}
87
88const splitGitPatch = (patch: Git.Patch) => {
89 const starts = [...patch.text.matchAll(/(?:^|\n)diff --git /g)].map((match) =>
90 match[0].startsWith("\n") ? match.index + 1 : match.index,
91 )
92 const chunks = starts.map((start, index) => patch.text.slice(start, starts[index + 1] ?? patch.text.length))
93 if (!patch.truncated) return chunks
94 return chunks.slice(0, -1)
95}
96
97const batchPatches = Effect.fnUntraced(function* (
98 git: Git.Interface,

Callers 1

vcs.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected