(opts: ShowWithDeps)
| 139 | } |
| 140 | |
| 141 | export async function showWith(opts: ShowWithDeps): Promise<CommitView> { |
| 142 | const dir = opts.dir ?? "/"; |
| 143 | try { |
| 144 | const oid = await opts.git.resolveRef({ fs: opts.fs, dir, ref: opts.ref }); |
| 145 | const { commit } = await opts.git.readCommit({ |
| 146 | fs: opts.fs, |
| 147 | dir, |
| 148 | oid, |
| 149 | cache: opts.cache, |
| 150 | }); |
| 151 | return { |
| 152 | oid, |
| 153 | message: commit.message, |
| 154 | tree: commit.tree, |
| 155 | parent: commit.parent, |
| 156 | author: commit.author, |
| 157 | committer: commit.committer, |
| 158 | }; |
| 159 | } catch (cause) { |
| 160 | if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause }); |
| 161 | throw new GitError("ESHOWFAIL", `git show failed: ${errorMessage(cause)}`, { cause }); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | // --------------------------------------------------------------- |
| 166 | // rev-parse |
no test coverage detected