simple-git
Advanced tools
Comparing version 1.27.0 to 1.28.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.27.0", | ||
"version": "1.28.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -95,3 +95,5 @@ # Simple Git | ||
`.reset(resetMode, handlerFn)` resets the repository (resetMode can be 'hard' or 'soft', handlerFn: (err)) | ||
`.reset([resetMode,] handlerFn)` resets the repository, the optional first argument can either be an array of options | ||
supported by the `git reset` command or one of the string constants `hard` or `soft`, if omitted the reset will be | ||
a soft reset to head, handlerFn: (err)) | ||
@@ -98,0 +100,0 @@ `.revparse([options], handlerFn)` wraps git rev-parse. Primarily used to convert friendly commit references (ie branch names) to SHA1 hashes. Options should be an array of string options compatible with the [git rev-parse](http://git-scm.com/docs/git-rev-parse) |
@@ -257,10 +257,17 @@ (function () { | ||
* | ||
* @param {string} [mode=soft] Either 'soft' or 'hard' | ||
* @param {string|string[]} [mode=soft] Either an array of arguments supported by the 'git reset' command, or the | ||
* string value 'soft' or 'hard' to set the reset mode. | ||
* @param {Function} [then] | ||
*/ | ||
Git.prototype.reset = function (mode, then) { | ||
var resetMode = '--' + (mode === 'hard' ? mode : 'soft'); | ||
var next = (typeof arguments[arguments.length - 1] === "function") ? arguments[arguments.length - 1] : null; | ||
var command = ['reset']; | ||
var next = Git.trailingFunctionArgument(arguments); | ||
if (next === mode || typeof mode === 'string' || !mode) { | ||
command.push('--' + (mode === 'hard' ? mode : 'soft')); | ||
} | ||
else if (Array.isArray(mode)) { | ||
command.push.apply(command, mode); | ||
} | ||
return this._run(['reset', resetMode], function (err) { | ||
return this._run(command, function (err) { | ||
next && next(err || null); | ||
@@ -267,0 +274,0 @@ }); |
@@ -516,2 +516,24 @@ | ||
'reset hard to commit': function (test) { | ||
git.reset(['commit-ish', '--hard'], function (err) { | ||
test.equals(null, err, 'not an error'); | ||
test.same( | ||
["reset", "commit-ish", "--hard"], | ||
theCommandRun()); | ||
test.done(); | ||
}); | ||
closeWith(''); | ||
}, | ||
'reset hard to commit with no handler': function (test) { | ||
git.reset(['commit-ish', '--hard']); | ||
closeWith(''); | ||
setTimeout(function () { | ||
test.same(["reset", "commit-ish", "--hard"], theCommandRun()); | ||
test.done(); | ||
}); | ||
}, | ||
'no handler': function (test) { | ||
@@ -518,0 +540,0 @@ git.reset(); |
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
73694
1740
186