MCPcopy
hub / github.com/claude-code-best/claude-code / adjustHunkLineNumbers

Function adjustHunkLineNumbers

src/utils/diff.ts:17–27  ·  view source on GitHub ↗
(
  hunks: StructuredPatchHunk[],
  offset: number,
)

Source from the content-addressed store, hash-verified

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

Callers 3

diff.test.tsFile · 0.90
loadRejectionDiffFunction · 0.85
loadDiffDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected