diff --git a/generate/descriptor.json b/generate/descriptor.json index 2483a94f5..0131afbd1 100644 --- a/generate/descriptor.json +++ b/generate/descriptor.json @@ -699,6 +699,11 @@ "args": [{ "isSelf": true }] }, + "git_remote_set_pushurl": { + "ignore": false, + "args": [{ "isSelf": true, "isReturn": false }] + }, + "git_remote_load": { "ignore": false, "isConstructorMethod": true, diff --git a/generate/partials/sync_function.cc b/generate/partials/sync_function.cc index d0f8c995c..c5fc0297d 100644 --- a/generate/partials/sync_function.cc +++ b/generate/partials/sync_function.cc @@ -55,6 +55,13 @@ from_{{ arg.name }} {%if not .|returnsCount %} NanReturnUndefined(); {%else%} + {%if return.cType | isPointer %} + // null checks on pointers + if (!result) { + NodeGitPsueodoNanReturnEscapingValue(NanUndefined()); + } + {%endif%} + Handle to; {%if .|returnsCount > 1 %} Handle toReturn = NanNew(); diff --git a/test/tests/attr.js b/test/tests/attr.js index b6973cf40..878c445fd 100644 --- a/test/tests/attr.js +++ b/test/tests/attr.js @@ -1,7 +1,7 @@ var assert = require("assert"); var path = require("path"); -describe("Blob", function() { +describe("Attr", function() { var reposPath = path.resolve("test/repos/workdir/.git"); var Repository = require("../../lib/repository"); @@ -29,11 +29,11 @@ describe("Blob", function() { it.skip("can lookup the value of a git attribute", function() { var flags = Attr.Check.NO_SYSTEM; var getAttr = Attr.get(this.repository, flags, ".gitattributes", "test"); - + return getAttr.then(function(val) { console.log(val); }).catch(function(ex) { - console.log(ex); + console.log(ex); }); }); }); diff --git a/test/tests/remote.js b/test/tests/remote.js index a830f783a..2aea7a2aa 100644 --- a/test/tests/remote.js +++ b/test/tests/remote.js @@ -7,22 +7,33 @@ describe("Remote", function() { var Repository = require("../../lib/repository"); var Remote = require("../../lib/remote"); + function removeOrigins(repository) { + return Remote.load(repository, "origin1").then(function(remote) { + remote.delete(); + + return Remote.load(repository, "origin2").then(function(remote) { + remote.delete(); + }); + }).catch(function() {}); + } + before(function() { var test = this; return Repository.open(reposPath).then(function(repository) { test.repository = repository; + return Remote.load(repository, "origin").then(function(remote) { test.remote = remote; + + return removeOrigins(repository); }); }); }); after(function() { - return Remote.load(this.repository, "origin2").then(function(remote) { - remote.delete(); - }); + return removeOrigins(this.repository); }); it("can load a remote", function() { @@ -35,6 +46,21 @@ describe("Remote", function() { "https://github.com/nodegit/nodegit"); }); + it("can push a remote", function() { + assert.equal(this.remote.pushurl(), undefined); + }); + + it("can set a remote", function() { + var repository = this.repository; + var url = "https://github.com/nodegit/nodegit"; + + return Remote.create(repository, "origin1", url).then(function(remote) { + return remote.setPushurl("https://google.com/", function() { + assert(remote.pushurl(), "https://google.com/"); + }); + }); + }); + it("can read the remote name", function() { assert.equal(this.remote.name(), "origin"); });