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