(
repositoryUrl: string,
targetPath: string
)
| 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(); |
nothing calls this directly
no test coverage detected