MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / adjustHunkLineNumbers

Function adjustHunkLineNumbers

source code/utils/diff.ts:19–29  ·  view source on GitHub ↗
(
  hunks: StructuredPatchHunk[],
  offset: number,
)

Source from the content-addressed store, hash-verified

17 * callers pass `ctx.lineOffset - 1` to convert slice-relative to file-relative.
18 */
19export function adjustHunkLineNumbers(
20 hunks: StructuredPatchHunk[],
21 offset: number,
22): StructuredPatchHunk[] {
23 if (offset === 0) return hunks
24 return hunks.map(h => ({
25 ...h,
26 oldStart: h.oldStart + offset,
27 newStart: h.newStart + offset,
28 }))
29}
30
31// For some reason, & confuses the diff library, so we replace it with a token,
32// then substitute it back in after the diff is computed.

Callers 2

loadRejectionDiffFunction · 0.85
loadDiffDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected