You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
323 B
16 lines
323 B
const which = require('which')
|
|
|
|
let gitPath
|
|
try {
|
|
gitPath = which.sync('git')
|
|
} catch (e) {}
|
|
|
|
module.exports = (opts = {}) => {
|
|
if (opts.git) {
|
|
return opts.git
|
|
}
|
|
if (!gitPath || opts.git === false) {
|
|
return Object.assign(new Error('No git binary found in $PATH'), { code: 'ENOGIT' })
|
|
}
|
|
return gitPath
|
|
}
|