Skip to content
Merged
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
5 changes: 5 additions & 0 deletions generate/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions generate/partials/sync_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Value> to;
{%if .|returnsCount > 1 %}
Handle<Object> toReturn = NanNew<Object>();
Expand Down
6 changes: 3 additions & 3 deletions test/tests/attr.js
Original file line number Diff line number Diff line change
@@ -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");
Expand Down Expand Up @@ -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);
});
});
});
32 changes: 29 additions & 3 deletions test/tests/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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");
});
Expand Down