( opts: RevParseWithDeps, dir: string, oid: string, step: RevStep, )
| 245 | } |
| 246 | |
| 247 | async function walkParent( |
| 248 | opts: RevParseWithDeps, |
| 249 | dir: string, |
| 250 | oid: string, |
| 251 | step: RevStep, |
| 252 | ): Promise<string> { |
| 253 | const { commit } = await opts.git.readCommit({ fs: opts.fs, dir, oid }); |
| 254 | const parent = commit.parent[step.n - 1]; |
| 255 | if (parent === undefined) { |
| 256 | throw new GitError( |
| 257 | "EREVPARSEFAIL", |
| 258 | `git rev-parse failed: ${oid.slice(0, 7)} has no parent ${step.n}`, |
| 259 | ); |
| 260 | } |
| 261 | return parent; |
| 262 | } |
| 263 | |
| 264 | // --------------------------------------------------------------- |
| 265 | // repo-root (rev-parse --show-toplevel) |
no test coverage detected