From fe0bf5571797f7df57ee393d2a57ba4880aed8ed Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Thu, 28 Feb 2019 09:43:46 -0400 Subject: [PATCH] add error code for UnresolvedConflicts (#306) * add error code to detect when conflicts are unresolved * add test for new error code --- lib/errors.ts | 3 +++ test/fast/git-process-test.ts | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/errors.ts b/lib/errors.ts index 99c6f40f..cd6d33e5 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -38,6 +38,7 @@ export enum GitError { LockFileAlreadyExists, NoMergeToAbort, LocalChangesOverwritten, + UnresolvedConflicts, // GitHub-specific error codes PushWithFileSizeExceedingLimit, HexBranchNameRejected, @@ -107,6 +108,8 @@ export const GitErrorRegexes = { 'fatal: There is no merge to abort': GitError.NoMergeToAbort, 'error: (?:Your local changes to the following|The following untracked working tree) files would be overwritten by checkout:': GitError.LocalChangesOverwritten, + 'You must edit all merge conflicts and then\nmark them as resolved using git add': + GitError.UnresolvedConflicts, // GitHub-specific errors 'error: GH001: ': GitError.PushWithFileSizeExceedingLimit, 'error: GH002: ': GitError.HexBranchNameRejected, diff --git a/test/fast/git-process-test.ts b/test/fast/git-process-test.ts index f52b4067..223b9b73 100644 --- a/test/fast/git-process-test.ts +++ b/test/fast/git-process-test.ts @@ -414,5 +414,14 @@ remove the file manually to continue.` error = GitProcess.parseError(stderr) expect(error).toBe(GitError.LocalChangesOverwritten) }) + + it('can parse the unresovled conflicts error', () => { + const stderr = `2-simple-rebase-conflict/LICENSE.md: needs merge +You must edit all merge conflicts and then +mark them as resolved using git add` + + const error = GitProcess.parseError(stderr) + expect(error).toBe(GitError.UnresolvedConflicts) + }) }) })