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

Function parseDiffMetadataPathLines

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

Source from the content-addressed store, hash-verified

120}
121
122export function parseDiffMetadataPathLines(lines: string[]): DiffPathPair {
123 let oldPath: string | undefined;
124 let newPath: string | undefined;
125
126 for (const line of lines) {
127 if (line.startsWith("rename from ") || line.startsWith("copy from ")) {
128 const parsed = parseDiffMetadataPathToken(line.slice(line.indexOf(" from ") + " from ".length));
129 if (parsed !== "/dev/null") oldPath = parsed;
130 } else if (line.startsWith("rename to ") || line.startsWith("copy to ")) {
131 const parsed = parseDiffMetadataPathToken(line.slice(line.indexOf(" to ") + " to ".length));
132 if (parsed !== "/dev/null") newPath = parsed;
133 }
134 }
135
136 return { oldPath, newPath };
137}

Callers 2

pr-github.test.tsFile · 0.90
rewritePatchChunkFunction · 0.90

Calls 1

Tested by

no test coverage detected