Socket
Socket
Sign inDemoInstall

simple-git

Package Overview
Dependencies
Maintainers
1
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-git - npm Package Compare versions

Comparing version 1.9.0 to 1.10.0

src/CommitSummary.js

2

package.json
{
"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 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc