From 10ffcc41f71f6e97b058fb3455aed72041e03ca5 Mon Sep 17 00:00:00 2001 From: Sergio Padrino Date: Mon, 22 Mar 2021 13:26:59 +0100 Subject: [PATCH] Parse error when GPG fails to sign data --- lib/errors.ts | 2 ++ test/fast/git-process-test.ts | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/errors.ts b/lib/errors.ts index bdb12188..858b07d6 100644 --- a/lib/errors.ts +++ b/lib/errors.ts @@ -39,6 +39,7 @@ export enum GitError { NoMergeToAbort, LocalChangesOverwritten, UnresolvedConflicts, + GPGFailedToSignData, // Start of GitHub-specific error codes PushWithFileSizeExceedingLimit, HexBranchNameRejected, @@ -119,6 +120,7 @@ export const GitErrorRegexes: { [regexp: string]: GitError } = { GitError.LocalChangesOverwritten, 'You must edit all merge conflicts and then\nmark them as resolved using git add|fatal: Exiting because of an unresolved conflict': GitError.UnresolvedConflicts, + 'error: gpg failed to sign the data': GitError.GPGFailedToSignData, // 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 4eb4017e..8b2e8f3c 100644 --- a/test/fast/git-process-test.ts +++ b/test/fast/git-process-test.ts @@ -424,6 +424,15 @@ mark them as resolved using git add` expect(error).toBe(GitError.UnresolvedConflicts) }) + it('can parse the failed to sign data error within a rebase', () => { + const stderr = `Rebasing (1/4) + Rebasing (2/4) + error: gpg failed to sign the data` + + const error = GitProcess.parseError(stderr) + expect(error).toBe(GitError.GPGFailedToSignData) + }) + it('can parse the could not resolve host error', () => { const stderr = `"Cloning into '/cloneablepath/'...\nfatal: unable to access 'https://github.com/Daniel-McCarthy/dugite.git/': Could not resolve host: github.com\n"`