UNPKG

376 BJavaScriptView Raw
1var exec = require('./exec')
2
3function getGitRootFolder (cb) {
4 return exec('git rev-parse --show-toplevel').then(
5 function (path) {
6 path = path.trim()
7 if (cb) {
8 cb(null, path)
9 }
10 return path
11 },
12 function (err) {
13 if (cb) {
14 cb(err)
15 } else {
16 throw err
17 }
18 }
19 )
20}
21
22module.exports = getGitRootFolder