MCPcopy
hub / github.com/generalaction/emdash / cloneRepository

Method cloneRepository

packages/core/src/git/git-runtime.ts:132–155  ·  view source on GitHub ↗
(
    repositoryUrl: string,
    targetPath: string
  )

Source from the content-addressed store, hash-verified

130 }
131
132 async cloneRepository(
133 repositoryUrl: string,
134 targetPath: string
135 ): Promise<Result<GitRepositoryInfo, CloneRepositoryError>> {
136 this.assertOpen();
137 const resolvedTargetPath = path.resolve(targetPath);
138 try {
139 await this.exec
140 .withCwd(path.dirname(resolvedTargetPath))
141 .exec(['clone', repositoryUrl, resolvedTargetPath]);
142 } catch (error) {
143 return err(classifyCloneRepositoryError(error, resolvedTargetPath));
144 }
145
146 const inspected = await this.inspectResolvedPath(resolvedTargetPath);
147 if (inspected.kind === 'repository') return ok(inspected);
148 if (inspected.kind === 'inspect-failed') {
149 return err({ type: 'git_error', message: inspected.message });
150 }
151 return err({
152 type: 'git_error',
153 message: `Cloned path is not a git repository: ${resolvedTargetPath}`,
154 });
155 }
156
157 async openRepository(pathInsideRepo: string): Promise<RepoLease> {
158 this.assertOpen();

Callers

nothing calls this directly

Calls 8

assertOpenMethod · 0.95
inspectResolvedPathMethod · 0.95
errFunction · 0.90
okFunction · 0.90
resolveMethod · 0.65
execMethod · 0.65
withCwdMethod · 0.45

Tested by

no test coverage detected