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
Add support for Remote.defaultBranch
  • Loading branch information
srajko committed Jan 21, 2016
commit 87254ce648eb6d1f16078b55297579e1b89b99f9
13 changes: 12 additions & 1 deletion generate/input/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,18 @@
}
},
"git_remote_default_branch": {
"ignore": true
"isAsync": true,
"args": {
"out": {
"isReturn": true
},
"remote": {
"isSelf": true
}
},
"return": {
"isErrorCode": true
}
},
"git_remote_delete": {
"isAsync": true,
Expand Down
16 changes: 16 additions & 0 deletions test/tests/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,22 @@ describe("Remote", function() {
});
});

it("can get the default branch of a remote", function() {
var remoteCallbacks = {
certificateCheck: function() {
return 1;
}
};

var remote = this.remote;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't wait until we can use => syntax and avoid re-assignment like this.


return remote.connect(NodeGit.Enums.DIRECTION.FETCH, remoteCallbacks)
.then(function() { return remote.defaultBranch(); })
.then(function(branchName) {
assert.equal("refs/heads/master", branchName);
});
});

it("can fetch from a remote", function() {
return this.repository.fetch("origin", {
callbacks: {
Expand Down