diff --git a/generate/input/descriptor.json b/generate/input/descriptor.json index 768a9b5a6..6c4da260c 100644 --- a/generate/input/descriptor.json +++ b/generate/input/descriptor.json @@ -1431,9 +1431,6 @@ "git_repository_fetchhead_foreach": { "ignore": true }, - "git_repository_free": { - "ignore": true - }, "git_repository_hashfile": { "ignore": true }, diff --git a/generate/scripts/helpers.js b/generate/scripts/helpers.js index 49cf3be44..733e546a6 100644 --- a/generate/scripts/helpers.js +++ b/generate/scripts/helpers.js @@ -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); diff --git a/test/runner.js b/test/runner.js index 3f78715f4..8f59382ed 100644 --- a/test/runner.js +++ b/test/runner.js @@ -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; + } +}); diff --git a/test/tests/clone.js b/test/tests/clone.js index 6f485672e..5c44f5f4c 100644 --- a/test/tests/clone.js +++ b/test/tests/clone.js @@ -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"); @@ -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() { @@ -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(); }); }); @@ -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(); }); }); @@ -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(); }); }); @@ -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(); }); }); @@ -111,8 +112,10 @@ 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(); }); }); @@ -120,15 +123,17 @@ describe("Clone", 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;