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
9 changes: 7 additions & 2 deletions generate/input/descriptor.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,16 +178,21 @@
"ignore": true
},
"git_branch_set_upstream": {
"isAsync": false,
"isAsync": true,
"args": {
"upstream_name": {
"isOptional": true
}
},
"return" : {
"isReturn": true,
"isErrorCode": true
}
},
"git_branch_upstream": {
"isAsync": false,
"isAsync": true,
"return" : {
"isReturn": true,
"isErrorCode": true
}
}
Expand Down
3 changes: 0 additions & 3 deletions generate/scripts/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,10 @@ var Helpers = {
// available
if (key == typeDef.cType + "_free") {
typeDef.freeFunctionName = key;
//fnDef.ignore = true;
//return;
}

fnDef.cppFunctionName = Helpers.cTypeToCppName(key, "git_" + typeDef.typeName);
fnDef.jsFunctionName = Helpers.cTypeToJsName(key, "git_" + typeDef.typeName);
//fnDef.isAsync = false; // until proven otherwise

if (fnDef.cppFunctionName == typeDef.cppClassName) {
fnDef.cppFunctionName = fnDef.cppFunctionName.replace("Git", "");
Expand Down
13 changes: 13 additions & 0 deletions test/tests/branch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ describe("Branch", function() {
var Branch = NodeGit.Branch;
var branchName = "test-branch";
var fullBranchName = "refs/heads/" + branchName;
var upstreamName = "origin/master";

var reposPath = local("../repos/workdir");

Expand Down Expand Up @@ -56,4 +57,16 @@ describe("Branch", function() {
assert.ok(branch.isHead());
});
});

it("can set an upstream for a branch", function() {
var branch = this.branch;

return NodeGit.Branch.setUpstream(branch, upstreamName)
.then(function() {
return NodeGit.Branch.upstream(branch);
})
.then(function(upstream) {
assert.equal(upstream.shorthand(), upstreamName);
});
});
});