( hunks: StructuredPatchHunk[], offset: number, )
| 15 | * callers pass `ctx.lineOffset - 1` to convert slice-relative to file-relative. |
| 16 | */ |
| 17 | export 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. |
no outgoing calls
no test coverage detected