Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow user to pass (repo, url, ref, callback) to refresh.

  • Loading branch information...
commit 24af678d1950c2e587d1e406a3b8501e473944f7 1 parent fa0a29c
@Kami Kami authored
Showing with 14 additions and 5 deletions.
  1. +14 −5 lib/util/git.js
View
19 lib/util/git.js
@@ -40,25 +40,34 @@ function gitd(repo, args, callback) {
exports.refresh = function(repo, url, remote, branch, callback) {
var ref;
- if (callback === undefined) {
+ if (arguments.length === 3) {
+ /* (repo, url, callback) */
callback = remote;
remote = 'origin';
branch = 'master';
+ ref = sprintf('%s/%s', remote, branch);
+ }
+ else if (arguments.length === 4) {
+ /* (repo, url, ref, callback) */
+ ref = remote;
+ callback = branch;
+ }
+ else {
+ /* (repo, url, remote, branch, callback) */
+ ref = sprintf('%s/%s', remote, branch);
}
-
- ref = sprintf('%s/%s', remote, branch);
path.exists(repo, function(exists) {
if (exists) {
async.series([
exports.fetch.bind(null, repo),
- exports.checkout.bind(null, repo, branch),
+ exports.checkout.bind(null, repo, ref),
exports.resetHard.bind(null, repo, ref)
], callback);
} else {
async.series([
exports.clone.bind(null, repo, url),
- exports.checkout.bind(null, repo, branch),
+ exports.checkout.bind(null, repo, ref),
exports.resetHard.bind(null, repo, ref)
], callback);
}
Please sign in to comment.
Something went wrong with that request. Please try again.