MCPcopy Index your code
hub / github.com/ds300/patch-package / parsePatchFile

Function parsePatchFile

src/patch/parse.ts:414–434  ·  view source on GitHub ↗
(file: string)

Source from the content-addressed store, hash-verified

412}
413
414export function parsePatchFile(file: string): ParsedPatchFile {
415 const lines = file.split(/\n/g)
416 if (lines[lines.length - 1] === "") {
417 lines.pop()
418 }
419 try {
420 return interpretParsedPatchFile(
421 parsePatchLines(lines, { supportLegacyDiffs: false }),
422 )
423 } catch (e) {
424 if (
425 e instanceof Error &&
426 e.message === "hunk header integrity check failed"
427 ) {
428 return interpretParsedPatchFile(
429 parsePatchLines(lines, { supportLegacyDiffs: true }),
430 )
431 }
432 throw e
433 }
434}
435
436export function verifyHunkIntegrity(hunk: Hunk) {
437 // verify hunk integrity

Callers 4

executeTestCaseFunction · 0.90
makePatchFunction · 0.90
readPatchFunction · 0.90
parse.test.tsFile · 0.90

Calls 2

interpretParsedPatchFileFunction · 0.85
parsePatchLinesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…