( run: ChapterRunRow, repoRoot: string, patch: string, )
| 205 | } else { |
| 206 | const firstLine = text.slice(0, text.indexOf("\n") === -1 ? undefined : text.indexOf("\n")); |
| 207 | const halves = splitEqualGitHeader(firstLine); |
| 208 | if (halves) { |
| 209 | [oldPath, newPath] = halves; |
| 210 | } else { |
| 211 | const header = text.match(DIFF_GIT_RE); |
| 212 | oldPath = header?.[1] ?? null; |
| 213 | newPath = header?.[2] ?? null; |
| 214 | } |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | results.push({ oldPath, newPath, isBinary, oldIsSymlink, newIsSymlink, modeUnknown }); |
| 219 | } |
| 220 | |
| 221 | return results; |
| 222 | } |
| 223 | |
| 224 | /** Adapter: decode an already-unwrapped quoted capture, tolerating absence. */ |
| 225 | function decodeQuotedGitPathCapture(capture: string | undefined): string | null { |
| 226 | if (capture === undefined) return null; |
| 227 | return decodeQuotedGitPath(capture); |
| 228 | } |
| 229 | |
| 230 | async function getGitFileContent( |
| 231 | cwd: string, |
| 232 | ref: string, |
| 233 | filePath: string, |
| 234 | ): Promise<string | null> { |
| 235 | try { |
| 236 | const { stdout } = await execFileAsync("git", ["show", `${ref}:${filePath}`], { |
| 237 | cwd, |
no test coverage detected