|
|
@ -36,23 +36,33 @@ module.exports = function (options, globalCallback) { |
|
|
|
|
|
|
|
|
|
|
|
console.log("Cloning %s to %s", url, path); |
|
|
|
console.log("Cloning %s to %s", url, path); |
|
|
|
|
|
|
|
|
|
|
|
nodegit.Clone(url, path) |
|
|
|
nodegit.Repository.init(path, 1) |
|
|
|
.catch(function(err) { |
|
|
|
.catch(globalCallback) |
|
|
|
return globalCallback(err); |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.then(function (repo) { |
|
|
|
.then(function (repo) { |
|
|
|
|
|
|
|
nodegit.Remote.create(repo, "origin", url) |
|
|
|
|
|
|
|
.catch(globalCallback) |
|
|
|
|
|
|
|
.then(function (remote) { |
|
|
|
|
|
|
|
remote.fetch([options.branch]) |
|
|
|
|
|
|
|
.catch(globalCallback) |
|
|
|
|
|
|
|
.then(function (number) { |
|
|
|
|
|
|
|
if (number) { |
|
|
|
|
|
|
|
return globalCallback("Failed to fetch commit: error number " + number); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
console.log("Cloned %s to %s", url, path); |
|
|
|
console.log("Cloned %s to %s", url, path); |
|
|
|
|
|
|
|
|
|
|
|
repo.getCommit(options.hash, function (err, commit) { |
|
|
|
repo.getCommit(options.hash) |
|
|
|
if (err) { |
|
|
|
.catch(globalCallback) |
|
|
|
return globalCallback(err); |
|
|
|
.then(function (commit) { |
|
|
|
} |
|
|
|
removedirs(exported); |
|
|
|
|
|
|
|
mkdirs(exported); |
|
|
|
|
|
|
|
|
|
|
|
removedirs(exported); |
|
|
|
gitToFs(commit, exported, function (err, result) { |
|
|
|
mkdirs(exported); |
|
|
|
repo.free(); |
|
|
|
|
|
|
|
return globalCallback(err, result); |
|
|
|
gitToFs(commit, exported, globalCallback); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|