MCPcopy Index your code
hub / github.com/npmx-dev/npmx.dev / processHunk

Function processHunk

shared/utils/diff.ts:297–321  ·  view source on GitHub ↗
(
  raw: {
    changes: RawChange[]
    oldStart: number
    oldLines: number
    newStart: number
    newLines: number
    content: string
  },
  options: ParseOptions,
)

Source from the content-addressed store, hash-verified

295}
296
297function processHunk(
298 raw: {
299 changes: RawChange[]
300 oldStart: number
301 oldLines: number
302 newStart: number
303 newLines: number
304 content: string
305 },
306 options: ParseOptions,
307): DiffHunk {
308 const lines = options.mergeModifiedLines
309 ? mergeAdjacentLines(raw.changes, options)
310 : raw.changes.map(changeToLine)
311
312 return {
313 type: 'hunk',
314 content: raw.content,
315 oldStart: raw.oldStart,
316 oldLines: raw.oldLines,
317 newStart: raw.newStart,
318 newLines: raw.newLines,
319 lines,
320 }
321}
322
323export function insertSkipBlocks(hunks: DiffHunk[]): (DiffHunk | DiffSkipBlock)[] {
324 const result: (DiffHunk | DiffSkipBlock)[] = []

Callers 1

parseUnifiedDiffFunction · 0.85

Calls 1

mergeAdjacentLinesFunction · 0.85

Tested by

no test coverage detected