(chunk: string)
| 76 | } |
| 77 | |
| 78 | const fileFromPatchChunk = (chunk: string) => { |
| 79 | const next = /^\+\+\+ (.+)$/m.exec(chunk)?.[1] |
| 80 | const before = /^--- (.+)$/m.exec(chunk)?.[1] |
| 81 | const file = fileFromDiffPath(next) ?? fileFromDiffPath(before) |
| 82 | if (file) return file |
| 83 | |
| 84 | const header = /^diff --git (.+)$/m.exec(chunk)?.[1] |
| 85 | return fileFromGitHeader(header ?? "") |
| 86 | } |
| 87 | |
| 88 | const splitGitPatch = (patch: Git.Patch) => { |
| 89 | const starts = [...patch.text.matchAll(/(?:^|\n)diff --git /g)].map((match) => |
no test coverage detected