MCPcopy
hub / github.com/Rich-Harris/degit / cloneAndReadFile

Function cloneAndReadFile

test/unit/index.test.ts:141–157  ·  view source on GitHub ↗
(test, archiveFile, dest, filePath, gitCloneOutput)

Source from the content-addressed store, hash-verified

139}
140
141async function cloneAndReadFile(test, archiveFile, dest, filePath, gitCloneOutput) {
142 const fetch = createCopyFetch(archiveFile);
143 const gitMock = createMockGit({
144 [`fetchRefs ${test.url}`]: gitRefs,
145 [`clone ${test.url} ${dest} HEAD`]: (_repo, cloneDest) => {
146 fs.mkdirSync(cloneDest, { recursive: true });
147 fs.writeFileSync(path.join(cloneDest, filePath), gitCloneOutput);
148 },
149 });
150
151 await degit(test.publicSrc, {
152 git: gitMock.fn,
153 fetch: fetch.fn,
154 }).clone(dest);
155
156 return { fetch, gitMock };
157}
158
159async function cloneAndExpectGitFallback(test, archiveFile, dest) {
160 const { fetch, gitMock } = await cloneAndReadFile(

Callers 1

Calls 4

degitFunction · 0.85
cloneMethod · 0.80
createCopyFetchFunction · 0.50
createMockGitFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…