(opts: ConfigSetWithDeps)
| 264 | } |
| 265 | |
| 266 | export async function configSetWith(opts: ConfigSetWithDeps): Promise<void> { |
| 267 | const dir = opts.dir ?? "/"; |
| 268 | try { |
| 269 | await opts.git.setConfig({ |
| 270 | fs: opts.fs, |
| 271 | dir, |
| 272 | path: opts.path, |
| 273 | value: opts.value, |
| 274 | append: opts.append, |
| 275 | }); |
| 276 | } catch (cause) { |
| 277 | if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause }); |
| 278 | throw new GitError("ECONFIGFAIL", `git config failed: ${errorMessage(cause)}`, { |
| 279 | cause, |
| 280 | }); |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | function errorMessage(cause: unknown): string { |
| 285 | if (cause instanceof Error) return cause.message; |
no test coverage detected