Skip to content

Commit

Permalink
Add parseBadConfigValueErrorInfo function
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiou87 committed Mar 13, 2024
1 parent ab30fb8 commit 6081edf
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/git-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] }
}
}

/**
Expand Down

0 comments on commit 6081edf

Please sign in to comment.