MCPcopy Index your code
hub / github.com/anomalyco/opencode / patchInput

Function patchInput

packages/session-ui/src/components/session-diff.ts:125–135  ·  view source on GitHub ↗
(file: string, patch: string)

Source from the content-addressed store, hash-verified

123}
124
125function patchInput(file: string, patch: string) {
126 try {
127 const parsed = parsePatch(patch)[0]
128 if (!parsed) return
129 if (parsed.index || parsed.oldFileName || parsed.newFileName) return patch
130 if (!parsed.hunks.length) return
131 return `Index: ${file}\n===================================================================\n--- ${file}\t\n+++ ${file}\t\n${patch}`
132 } catch {
133 return
134 }
135}
136
137function fileDiffFromContent(file: string, before: string, after: string) {
138 if (!before && !after) return emptyFileDiff(file)

Callers 1

fileDiffFromPatchFunction · 0.85

Calls 1

parsePatchFunction · 0.85

Tested by

no test coverage detected