fix: use spawn instead of exec for 'git log' to avoid maxBuffer err

This commit is contained in:
Ben Gummer
2016-11-28 15:50:59 +01:00
committed by Stephan Bönnemann
parent d7f5d19073
commit 73138f8a8f
3 changed files with 33 additions and 21 deletions
+13 -7
View File
@@ -1,3 +1,15 @@
var mockSpawn = require('mock-spawn')()
mockSpawn.setStrategy(function (command, args, opts) {
return function (cb) {
this.stdout.write(
/\.\.HEAD/.test(args.join(' '))
? rawCommits[0]
: rawCommits.join()
)
cb(0)
}
})
const rawCommits = [
'hash-one==SPLIT==commit-one==END==\n',
'hash-two==SPLIT==commit-two==END==\n'
@@ -12,13 +24,7 @@ module.exports = {
if (/notinhistory/.test(command)) return cb(new Error())
return cb(null, 'whatever\nmaster\n')
}
cb(
null,
/\.\.HEAD/.test(command)
? rawCommits[0]
: rawCommits.join()
)
},
spawn: mockSpawn,
'@noCallThru': true
}