simple-git
Advanced tools
Comparing version 1.9.0 to 1.10.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.9.0", | ||
"version": "1.10.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -144,3 +144,3 @@ (function () { | ||
return this._run(['commit', '-m', message].concat([].concat(files || [])), function (err, data) { | ||
then && then(err, !err && git._parseCommit(data)); | ||
then && then(err, !err && require('./CommitSummary').parse(data)); | ||
}); | ||
@@ -643,18 +643,2 @@ }; | ||
Git.prototype._parseCommit = function (commit) { | ||
var lines = commit.trim().split('\n'); | ||
var branch = /\[([^\s]+) ([^\]]+)/.exec(lines.shift()); | ||
var summary = /(\d+)[^,]*(?:,\s*(\d+)[^,]*)?(?:,\s*(\d+))?/g.exec(lines.shift()) || []; | ||
return { | ||
branch: branch[1], | ||
commit: branch[2], | ||
summary: { | ||
changes: (typeof summary[1] !== 'undefined') ? summary[1] : 0, | ||
insertions: (typeof summary[2] !== 'undefined') ? summary[2] : 0, | ||
deletions: (typeof summary[3] !== 'undefined') ? summary[3] : 0 | ||
} | ||
}; | ||
}; | ||
Git.prototype._parseCheckout = function (checkout) { | ||
@@ -661,0 +645,0 @@ // TODO |
@@ -23,3 +23,3 @@ | ||
return git = new Git(baseDir, new MockChildProcess, sinon.spy()); | ||
return git = new Git(baseDir, new MockChildProcess, {concat: sinon.spy(function (things) { return [].join.call(things, '\n'); })}); | ||
} | ||
@@ -159,2 +159,24 @@ | ||
create mode 100644 src/index.js'); | ||
}, | ||
'commit when no files are staged': function (test) { | ||
git.commit('some message', function (err, commit) { | ||
test.equals('', commit.branch, 'Should pick up branch name'); | ||
test.equals('', commit.commit, 'Should pick up commit hash'); | ||
test.equals(0, commit.summary.changes, 'Should pick up changes count'); | ||
test.equals(0, commit.summary.deletions, 'Should pick up deletions count'); | ||
test.equals(0, commit.summary.insertions, 'Should pick up insertions count'); | ||
test.done(); | ||
}); | ||
closeWith('On branch master\n\ | ||
Your branch is ahead of \'origin/master\' by 1 commit.\n\ | ||
(use "git push" to publish your local commits)\n\n\ | ||
Changes not staged for commit:\n\ | ||
modified: src/some-file.js\n\ | ||
modified: src/another-file.js\n\n\ | ||
no changes added to commit\n\ | ||
'); | ||
} | ||
@@ -161,0 +183,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40355
9
890
2