MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / recur

Function recur

packages/plugins/apps/src/git-client/packfile.ts:589–604  ·  view source on GitHub ↗
(treeSha: string, prefix: string)

Source from the content-addressed store, hash-verified

587 const { tree } = parseCommit(commit.data);
588 const files: TreeFile[] = [];
589 const recur = (treeSha: string, prefix: string) => {
590 const t = parsed.objects.get(treeSha);
591 if (!t) throw new PackParseError(`tree ${treeSha} not in pack`);
592 for (const e of parseTree(t.data)) {
593 const full = prefix ? `${prefix}/${e.name}` : e.name;
594 if (e.mode === "40000" || e.mode === "040000") {
595 recur(e.sha, full);
596 } else if (e.mode === "160000") {
597 // gitlink/submodule; skip
598 } else {
599 const blob = parsed.objects.get(e.sha);
600 if (!blob) throw new PackParseError(`blob ${e.sha} (${full}) not in pack`);
601 files.push({ path: full, mode: e.mode, sha: e.sha, bytes: blob.data });
602 }
603 }
604 };
605 recur(tree, "");
606 return files;
607}

Callers 1

walkTreeFunction · 0.85

Calls 3

parseTreeFunction · 0.85
pushMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected