(header: string)
| 62 | } |
| 63 | |
| 64 | const fileFromGitHeader = (header: string) => { |
| 65 | if (header.startsWith('"')) { |
| 66 | const first = parseQuotedPath(header) |
| 67 | const second = first ? header.slice(first.end).trimStart() : undefined |
| 68 | if (!second) return |
| 69 | if (!second.startsWith('"')) return fileFromDiffPath(second) |
| 70 | return fileFromDiffPath(parseQuotedPath(second)?.value) |
| 71 | } |
| 72 | |
| 73 | const separator = header.indexOf(" b/") |
| 74 | if (separator === -1) return |
| 75 | return fileFromDiffPath(header.slice(separator + 1)) |
| 76 | } |
| 77 | |
| 78 | const fileFromPatchChunk = (chunk: string) => { |
| 79 | const next = /^\+\+\+ (.+)$/m.exec(chunk)?.[1] |
no test coverage detected