(lines: string[])
| 102 | } |
| 103 | |
| 104 | export 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 | |
| 122 | export function parseDiffMetadataPathLines(lines: string[]): DiffPathPair { |
| 123 | let oldPath: string | undefined; |
no test coverage detected