MCPcopy Create free account
hub / github.com/backnotprop/plannotator / splitDiffChunks

Function splitDiffChunks

packages/review-editor/utils/diffParser.ts:4–13  ·  view source on GitHub ↗
(rawPatch: string)

Source from the content-addressed store, hash-verified

2import type { DiffFile, DiffFileStatus } from '../types';
3
4function splitDiffChunks(rawPatch: string): string[] {
5 const matches = [...rawPatch.matchAll(/^diff --git /gm)];
6 if (matches.length === 0) return [];
7
8 return matches.map((match, index) => {
9 const start = match.index ?? 0;
10 const end = matches[index + 1]?.index ?? rawPatch.length;
11 return rawPatch.slice(start, end);
12 });
13}
14
15/**
16 * Change type from the chunk's git metadata lines. Scans only the extended

Callers 1

parseDiffToFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected