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

Function parseDiffFilePathLines

packages/shared/diff-paths.ts:104–120  ·  view source on GitHub ↗
(lines: string[])

Source from the content-addressed store, hash-verified

102}
103
104export function parseDiffFilePathLines(lines: string[]): DiffPathPair {
105 let oldPath: string | undefined;
106 let newPath: string | undefined;
107
108 for (const line of lines) {
109 if (line.startsWith("@@ ") || line === "GIT binary patch") break;
110 if (line.startsWith("--- ")) {
111 const parsed = parsePatchPathToken(line.slice(4), "a");
112 if (parsed && parsed !== "/dev/null") oldPath = parsed;
113 } else if (line.startsWith("+++ ")) {
114 const parsed = parsePatchPathToken(line.slice(4), "b");
115 if (parsed && parsed !== "/dev/null") newPath = parsed;
116 }
117 }
118
119 return { oldPath, newPath };
120}
121
122export function parseDiffMetadataPathLines(lines: string[]): DiffPathPair {
123 let oldPath: string | undefined;

Callers 4

pr-github.test.tsFile · 0.90
rewritePatchChunkFunction · 0.90
diff-paths.test.tsFile · 0.90
parseDiffToFilesFunction · 0.90

Calls 1

parsePatchPathTokenFunction · 0.85

Tested by

no test coverage detected