(opts: MergeWithDeps)
| 381 | } |
| 382 | |
| 383 | export async function mergeWith(opts: MergeWithDeps): Promise<MergeResult> { |
| 384 | const dir = opts.dir ?? "/"; |
| 385 | const author = resolveIdent( |
| 386 | opts.author, |
| 387 | opts.env?.GIT_AUTHOR_NAME, |
| 388 | opts.env?.GIT_AUTHOR_EMAIL, |
| 389 | opts.defaultIdentity, |
| 390 | ); |
| 391 | const committer = |
| 392 | resolveIdent( |
| 393 | opts.committer, |
| 394 | opts.env?.GIT_COMMITTER_NAME ?? opts.env?.GIT_AUTHOR_NAME, |
| 395 | opts.env?.GIT_COMMITTER_EMAIL ?? opts.env?.GIT_AUTHOR_EMAIL, |
| 396 | opts.defaultIdentity, |
| 397 | ) ?? author; |
| 398 | try { |
| 399 | return await opts.git.merge({ |
| 400 | fs: opts.fs, |
| 401 | dir, |
| 402 | ours: opts.ours, |
| 403 | theirs: opts.theirs, |
| 404 | fastForward: opts.fastForward, |
| 405 | fastForwardOnly: opts.fastForwardOnly, |
| 406 | message: opts.message, |
| 407 | author, |
| 408 | committer, |
| 409 | cache: opts.cache, |
| 410 | }); |
| 411 | } catch (cause) { |
| 412 | if (isNotARepositoryCause(cause)) throw new NotARepositoryError(dir, { cause }); |
| 413 | if ( |
| 414 | cause instanceof Error && |
| 415 | /Missing(Name|Email)Error|identity|cannot author/i.test(cause.message) |
| 416 | ) { |
| 417 | throw new MissingIdentityError({ cause }); |
| 418 | } |
| 419 | throw new GitError("EMERGEFAIL", `git merge failed: ${errorMessage(cause)}`, { cause }); |
| 420 | } |
| 421 | } |
| 422 | |
| 423 | // --------------------------------------------------------------- |
| 424 | // remote add / remove / list |
no test coverage detected