Skip to content
Closed
Show file tree
Hide file tree
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
3 changes: 0 additions & 3 deletions generate/input/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1431,9 +1431,6 @@
"git_repository_fetchhead_foreach": {
"ignore": true
},
"git_repository_free": {
"ignore": true
},
"git_repository_hashfile": {
"ignore": true
},
Expand Down
4 changes: 2 additions & 2 deletions generate/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ var Helpers = {
// available
if (key == typeDef.cType + "_free") {
typeDef.freeFunctionName = key;
fnDef.ignore = true;
return;
//fnDef.ignore = true;
//return;
}

fnDef.cppFunctionName = Helpers.cTypeToCppName(key, "git_" + typeDef.typeName);
Expand Down
12 changes: 12 additions & 0 deletions test/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,15 @@ beforeEach(function() {
return exec("git reset --hard", {cwd: workdirPath});
});
});

afterEach(function() {
if (this.repository) {
this.repository.free();
delete this.repository;
}

else if (this.repo) {
this.repo.free();
delete this.repo;
}
});
41 changes: 23 additions & 18 deletions test/tests/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@ describe("Clone", function() {
var Clone = require(local("../../lib/clone"));
var NodeGit = require(local("../../"));

var http = local("../repos/http");
var https = local("../repos/https");
var ssh = local("../repos/ssh");
var git = local("../repos/git");
var file = local("../repos/file");
var clonePath = local("../repos/clone");

var sshPublicKey = local("../id_rsa.pub");
var sshPrivateKey = local("../id_rsa");
Expand All @@ -23,12 +19,10 @@ describe("Clone", function() {

beforeEach(function() {
return NodeGit.Promise.all([
fse.remove(http),
fse.remove(https),
fse.remove(ssh),
fse.remove(git),
fse.remove(file)
]).catch(function unhandledFunction() {});
fse.remove(clonePath),
]).catch(function unhandledFunction(ex) {
console.log(ex.message);
});
});

it.skip("can clone with http", function() {
Expand All @@ -41,8 +35,9 @@ describe("Clone", function() {
}
};

return Clone.clone(url, http, opts).then(function(repo) {
return Clone.clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
repo.free();
});
});

Expand All @@ -56,8 +51,10 @@ describe("Clone", function() {
}
};

return Clone.clone(url, https, opts).then(function(repo) {
return Clone.clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
repo.stateCleanup();
repo.free();
});
});

Expand All @@ -74,8 +71,10 @@ describe("Clone", function() {
}
};

return Clone.clone(url, ssh, opts).then(function(repo) {
return Clone.clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
repo.stateCleanup();
repo.free();
});
});

Expand All @@ -96,8 +95,10 @@ describe("Clone", function() {
}
};

return Clone.clone(url, ssh, opts).then(function(repo) {
return Clone.clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
repo.stateCleanup();
repo.free();
});
});

Expand All @@ -111,24 +112,28 @@ describe("Clone", function() {
}
};

return Clone.clone(url, git, opts).then(function(repo) {
return Clone.clone(url, clonePath, opts).then(function(repo) {
assert.ok(repo instanceof Repository);
repo.stateCleanup();
repo.free();
});
});

it("can clone with filesystem", function() {
var prefix = process.platform === "win32" ? "" : "file://";
var url = prefix + local("../repos/empty");

return Clone.clone(url, file).then(function(repo) {
return Clone.clone(url, clonePath).then(function(repo) {
assert.ok(repo instanceof Repository);
repo.stateCleanup();
repo.free();
});
});

it("will not segfault when accessing a url without username", function() {
var url = "https://github.com/nodegit/private";

return Clone.clone(url, git, {
return Clone.clone(url, clonePath, {
remoteCallbacks: {
certificateCheck: function() {
return 1;
Expand Down