Skip to content

Commit 17209fc

Browse files
committed
Merge pull request #872 from srajko/remote-default-branch
Add support for Remote.defaultBranch
2 parents 54de790 + 87254ce commit 17209fc

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

generate/input/descriptor.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1602,7 +1602,18 @@
16021602
}
16031603
},
16041604
"git_remote_default_branch": {
1605-
"ignore": true
1605+
"isAsync": true,
1606+
"args": {
1607+
"out": {
1608+
"isReturn": true
1609+
},
1610+
"remote": {
1611+
"isSelf": true
1612+
}
1613+
},
1614+
"return": {
1615+
"isErrorCode": true
1616+
}
16061617
},
16071618
"git_remote_delete": {
16081619
"isAsync": true,

test/tests/remote.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,22 @@ describe("Remote", function() {
150150
});
151151
});
152152

153+
it("can get the default branch of a remote", function() {
154+
var remoteCallbacks = {
155+
certificateCheck: function() {
156+
return 1;
157+
}
158+
};
159+
160+
var remote = this.remote;
161+
162+
return remote.connect(NodeGit.Enums.DIRECTION.FETCH, remoteCallbacks)
163+
.then(function() { return remote.defaultBranch(); })
164+
.then(function(branchName) {
165+
assert.equal("refs/heads/master", branchName);
166+
});
167+
});
168+
153169
it("can fetch from a remote", function() {
154170
return this.repository.fetch("origin", {
155171
callbacks: {

0 commit comments

Comments
 (0)