(opts: RemoteListWithDeps)
| 492 | } |
| 493 | |
| 494 | export async function remoteListWith(opts: RemoteListWithDeps): Promise<RemoteView[]> { |
| 495 | const dir = opts.dir ?? "/"; |
| 496 | try { |
| 497 | const remotes = await opts.git.listRemotes({ fs: opts.fs, dir }); |
| 498 | return remotes.map((r) => ({ name: r.remote, url: r.url })); |
| 499 | } catch (cause) { |
| 500 | if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause }); |
| 501 | throw new GitError("EREMOTEFAIL", `git remote failed: ${errorMessage(cause)}`, { |
| 502 | cause, |
| 503 | }); |
| 504 | } |
| 505 | } |
| 506 | |
| 507 | function errorMessage(cause: unknown): string { |
| 508 | if (cause instanceof Error) return cause.message; |
no test coverage detected