simple-git
Advanced tools
Comparing version 1.26.0 to 1.26.2
@@ -29,5 +29,5 @@ module.exports = function (grunt) { | ||
grunt.registerTask('patch', ['test', 'release:bump:patch', '-to-git']); | ||
grunt.registerTask('minor', ['test', 'release:bump:minor', '-tag', '-to-git', '-to-npm']); | ||
grunt.registerTask('major', ['test', 'release:bump:major', '-tag', '-to-git', '-to-npm']); | ||
'patch minor major'.split(' ').forEach(function (type) { | ||
grunt.registerTask(type, ['test', 'release:bump:' + type, '-tag', '-to-git', '-to-npm']); | ||
}); | ||
@@ -34,0 +34,0 @@ grunt.registerTask('default', ['patch']); |
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.26.0", | ||
"version": "1.26.2", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -62,3 +62,5 @@ # Simple Git | ||
`.commit(message, handlerFn)` commits changes in the current working directory with the supplied message | ||
`.commit(message, handlerFn)` commits changes in the current working directory with the supplied message where the | ||
message can be either a single string or array of strings to be passed as separate arguments (the `git` command line | ||
interface converts these to be separated by double line breaks). | ||
@@ -65,0 +67,0 @@ `.commit(message, [fileA, ...], handlerFn)` commits changes on the named files with the supplied message |
module.exports = StatusSummary; | ||
/** | ||
* The StatusSummary is returned as a response to getting `git().status()` | ||
* | ||
* @constructor | ||
*/ | ||
function StatusSummary () { | ||
@@ -12,7 +17,37 @@ this.not_added = []; | ||
StatusSummary.prototype.ahead = null; | ||
StatusSummary.prototype.behind = null; | ||
/** | ||
* Number of commits ahead of the tracked branch | ||
* @type {number} | ||
*/ | ||
StatusSummary.prototype.ahead = 0; | ||
/** | ||
* Number of commits behind the tracked branch | ||
* @type {number} | ||
*/ | ||
StatusSummary.prototype.behind = 0; | ||
/** | ||
* Name of the current branch | ||
* @type {null} | ||
*/ | ||
StatusSummary.prototype.current = null; | ||
/** | ||
* Name of the branch being tracked | ||
* @type {string} | ||
*/ | ||
StatusSummary.prototype.tracking = null; | ||
/** | ||
* Gets whether this StatusSummary represents a clean working branch. | ||
* | ||
* @return {boolean} | ||
*/ | ||
StatusSummary.prototype.isClean = function () { | ||
return 0 === Object.keys(this).filter(function (name) { | ||
return Array.isArray(this[name]) && this[name].length; | ||
}, this).length; | ||
}; | ||
StatusSummary.parsers = { | ||
@@ -27,6 +62,6 @@ '##': function (line, status) { | ||
regexResult = aheadReg.exec(line); | ||
status.ahead = regexResult && regexResult[1]; | ||
status.ahead = regexResult && +regexResult[1] || 0; | ||
regexResult = behindReg.exec(line); | ||
status.behind = regexResult && regexResult[1]; | ||
status.behind = regexResult && +regexResult[1] || 0; | ||
@@ -33,0 +68,0 @@ regexResult = currentReg.exec(line); |
@@ -615,4 +615,4 @@ | ||
test.equals(statusSummary.tracking, 'origin/master'); | ||
test.equals(statusSummary.ahead, '3'); | ||
test.equals(statusSummary.behind, null); | ||
test.equals(statusSummary.ahead, 3); | ||
test.equals(statusSummary.behind, 0); | ||
@@ -628,5 +628,19 @@ statusSummary = StatusSummary.parse('?? Not tracked File\nUU Conflicted\n D Removed'); | ||
statusSummary = StatusSummary.parse('## this_branch'); | ||
test.equals(statusSummary.current, 'this_branch'); | ||
test.equals(statusSummary.tracking, null); | ||
test.done(); | ||
}, | ||
'reports on clean branch': function (test) { | ||
var StatusSummary = require('../src/StatusSummary'); | ||
['M', 'AM', 'UU', 'D'].forEach(function (type) { | ||
test.same(StatusSummary.parse(type + ' file-name.foo').isClean(), false); | ||
}); | ||
test.same(StatusSummary.parse('\n').isClean(), true); | ||
test.done(); | ||
}, | ||
'empty status': function (test) { | ||
@@ -633,0 +647,0 @@ git.status(function (err, status) { |
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
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
71288
1666
184