Compare commits

...
3 Commits
Author SHA1 Message Date
Ben GummerandStephan Bönnemann 73138f8a8f fix: use spawn instead of exec for 'git log' to avoid maxBuffer err 2016-11-28 15:50:59 +01:00
Mark DalgleishandChristoph Witzko d7f5d19073 docs(readme): fix link to how the CLI works 2016-11-28 11:34:33 +01:00
PAkerstrandandStephan Bönnemann f239f2f402 fix(commits): Use --no-color for git branch-command
When `git branch --contains ${commit}` has colored output the `inHistory` check failed
2016-11-21 09:46:44 -03:00
4 changed files with 34 additions and 22 deletions
+1 -1
View File
@@ -141,7 +141,7 @@ semantic-release-cli setup
![dialogue](https://cloud.githubusercontent.com/assets/908178/9428123/3628dfec-499f-11e5-8bdd-8f3042dd95ed.png)
_[This is what happens under the hood.](https://github.com/semantic-release/cli#manual-setup)_
_[This is what happens under the hood.](https://github.com/semantic-release/cli#what-it-does)_
## Options
+1
View File
@@ -36,6 +36,7 @@
"coveralls": "^2.11.4",
"cz-conventional-changelog": "^1.1.4",
"mkdirp": "^0.5.1",
"mock-spawn": "^0.2.6",
"nixt": "^0.5.0",
"nock": "^8.0.0",
"npm-registry-couchapp": "^2.6.11",
+19 -14
View File
@@ -1,4 +1,4 @@
var exec = require('child_process').exec
var childProcess = require('child_process')
var log = require('npmlog')
@@ -13,7 +13,7 @@ module.exports = function (config, cb) {
if (!from) return extract()
exec('git branch --contains ' + from, function (err, stdout) {
childProcess.exec('git branch --no-color --contains ' + from, function (err, stdout) {
var inHistory = false
var branches
@@ -47,28 +47,33 @@ module.exports = function (config, cb) {
})
function extract () {
exec(
'git log -E --format=%H==SPLIT==%B==END== ' + range,
{
maxBuffer: 1024 * 1024 // 1MB instead of 220KB (issue #286)
},
function (err, stdout) {
if (err) return cb(err)
var child = childProcess.spawn('git', ['log', '-E', '--format=%H==SPLIT==%B==END==', range])
var stdout = ''
var err = ''
cb(null, String(stdout).split('==END==\n')
child.stdout.on('data', function (data) {
stdout += data
})
child.stderr.on('data', function (data) {
err += data
})
child.on('close', function (code) {
if (err || code) return cb(err)
cb(null, String(stdout).split('==END==\n')
.filter(function (raw) {
return !!raw.trim()
})
.map(function (raw) {
var data = raw.split('==SPLIT==')
return {
hash: data[0],
message: data[1]
}
}))
}
)
})
)
})
}
}
+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
}