Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions examples/clone-recursive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
var nodegit = require("../");
var path = "tmp/nodegit-clone-demo";

var config = {
fetchOpts: {
callbacks: {
certificateCheck: function() {
// github will fail cert check on some OSX machines
// this overrides that check
return 1;
}
}
}
};

nodegit.Clone("https://github.com/nodegit/nodegit.git", path, config)
.then(function(repo){
console.log(1);
var p = Promise.resolve();
nodegit.Submodule.foreach(repo, function(submodule){
submodule.update(1, config);
p = p.then(function(){
return new Promise(function(resolve, reject){
submodule.update(1, config).then(resolve, reject);
});
});
}).then(function(){
p.then(function(){
console.log("Cloned!");
},function(error){
console.error(error);
});
});
})
.catch(console.log);