Skip to content

Commit

Permalink
fix(getConfig): Return empty string when a config entry is not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
vinsonchuong committed Dec 14, 2020
1 parent bdfc024 commit 60b3615
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/git/get-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import {promisify} from 'util'
const exec = promisify(childProcess.exec)

export default async function (name) {
const {stdout} = await exec(`git config --get ${name}`)
return stdout.trim()
try {
const {stdout} = await exec(`git config --get ${name}`)
return stdout.trim()
} catch {
return ''
}
}

0 comments on commit 60b3615

Please sign in to comment.