(lines: string[])
| 120 | } |
| 121 | |
| 122 | export 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 | } |
no test coverage detected