diff --git a/lib/git-process.ts b/lib/git-process.ts index def68479..8789fe50 100644 --- a/lib/git-process.ts +++ b/lib/git-process.ts @@ -291,6 +291,30 @@ export class GitProcess { return null } + + public static parseBadConfigValueErrorInfo( + stderr: string + ): { key: string; value: string } | null { + const errorEntry = Object.entries(GitErrorRegexes).find( + ([_, v]) => v === GitError.BadConfigValue + ) + + if (errorEntry === undefined) { + return null + } + + const m = stderr.match(errorEntry[0]) + + if (m === null) { + return null + } + + if (!m[1] || !m[2]) { + return null + } + + return { key: m[2], value: m[1] } + } } /**