simple-git
Advanced tools
Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "simple-git", | ||
"description": "Simple GIT interface for node.js", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"author": "Steve King <steve@mydev.co>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -71,3 +71,3 @@ (function () { | ||
Git.prototype.init = function (then) { | ||
return this._run('init', function (err) { | ||
return this._run(['init'], function (err) { | ||
then && then(err); | ||
@@ -83,3 +83,3 @@ }); | ||
Git.prototype.status = function (then) { | ||
return this._run('status --porcelain', function (err, data) { | ||
return this._run(['status', '--porcelain'], function (err, data) { | ||
then && then(err, !err && this._parseStatus(data)); | ||
@@ -313,3 +313,3 @@ }); | ||
Git.prototype.addRemote = function (remoteName, remoteRepo, then) { | ||
return this._run(['remote add "%s" "%s"', remoteName, remoteRepo], function (err) { | ||
return this._run(['remote', 'add', remoteName, remoteRepo], function (err) { | ||
then && then(err); | ||
@@ -327,3 +327,3 @@ }); | ||
Git.prototype.removeRemote = function (remoteName, then) { | ||
return this._run(['remote remove "%s"', remoteName], function (err) { | ||
return this._run(['remote', 'remove', remoteName], function (err) { | ||
then && then(err); | ||
@@ -342,5 +342,5 @@ }); | ||
Git.prototype.push = function (remote, branch, then) { | ||
var command = "push"; | ||
var command = ["push"]; | ||
if (typeof remote === 'string' && typeof branch === 'string') { | ||
command = ['push "%s" "%s"', remote, branch]; | ||
command.push(remote, branch); | ||
} | ||
@@ -384,7 +384,12 @@ if (typeof arguments[arguments.length - 1] === 'function') { | ||
Git.prototype.diff = function (options, then) { | ||
var command = 'diff'; | ||
var command = ['diff']; | ||
if (typeof options === 'string') { | ||
command += ' ' + options; | ||
command[0] += ' ' + options; | ||
this._getLog('warn', | ||
'Git#diff: supplying options as a single string is now deprecated, switch to an array of strings'); | ||
} | ||
else if (Array.isArray(options)) { | ||
command.push.apply(command, options); | ||
} | ||
@@ -409,5 +414,8 @@ if (typeof arguments[arguments.length - 1] === 'function') { | ||
var handler = typeof args[args.length - 1] === "function" ? args.pop() : null; | ||
var show = typeof args[0] === "string" ? args[0] : ''; | ||
var command = ['show']; | ||
if (typeof args[0] === "string") { | ||
command.push(args[0]) | ||
} | ||
return this._run('show ' + show, function(err, data) { | ||
return this._run(command, function(err, data) { | ||
handler && handler(err, !err && data); | ||
@@ -417,3 +425,2 @@ }); | ||
/** | ||
@@ -420,0 +427,0 @@ * Call a simple function |
29197
637