MCPcopy Create free account
hub / github.com/cloudflare/computer / showWith

Function showWith

packages/computer/src/git/reads.ts:141–163  ·  view source on GitHub ↗
(opts: ShowWithDeps)

Source from the content-addressed store, hash-verified

139}
140
141export 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

Callers 2

showFunction · 0.85
reads.test.tsFile · 0.85

Calls 4

isNotARepositoryCauseFunction · 0.85
readCommitMethod · 0.80
errorMessageFunction · 0.70
resolveRefMethod · 0.65

Tested by

no test coverage detected