Comparing version 0.0.4 to 0.1.0
22
index.js
@@ -12,2 +12,3 @@ var spawn = require('child_process').spawn; | ||
var git = opts.git || 'git'; | ||
var args = ['clone']; | ||
@@ -24,7 +25,10 @@ | ||
var process = spawn(opts.git || 'git', args); | ||
var process = spawn(git, args); | ||
process.on('close', function(status) { | ||
if (status == 0) { | ||
cb && cb(); | ||
if (opts.checkout) { | ||
_checkout(); | ||
} else { | ||
cb && cb(); | ||
} | ||
} else { | ||
@@ -35,2 +39,14 @@ cb && cb(new Error("'git clone' failed with status " + status)); | ||
function _checkout() { | ||
var args = ['checkout', opts.checkout]; | ||
var process = spawn(git, args, { cwd: targetPath }); | ||
process.on('close', function(status) { | ||
if (status == 0) { | ||
cb && cb(); | ||
} else { | ||
cb && cb(new Error("'git checkout' failed with status " + status)); | ||
} | ||
}); | ||
} | ||
} |
{ | ||
"name": "git-clone", | ||
"version": "0.0.4", | ||
"version": "0.1.0", | ||
"description": "Clone a git repository", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -23,4 +23,5 @@ # git-clone | ||
* `git`: path to `git` binary; default: `git`. | ||
* `shallow`: when `true`, clone with depth 1. | ||
* `git`: path to `git` binary; default: `git` (optional). | ||
* `shallow`: when `true`, clone with depth 1 (optional). | ||
* `checkout`: revision/branch/tag to check out (optional). | ||
@@ -27,0 +28,0 @@ ## Copyright & License |
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
2642
5
47
32