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

Function walkParent

packages/computer/src/git/reads.ts:247–262  ·  view source on GitHub ↗
(
  opts: RevParseWithDeps,
  dir: string,
  oid: string,
  step: RevStep,
)

Source from the content-addressed store, hash-verified

245}
246
247async 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)

Callers 1

revParseWithFunction · 0.85

Calls 1

readCommitMethod · 0.80

Tested by

no test coverage detected