You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a branch using the Repository#createBranch method but it throws an empty error "{}". Could you guys take a look at what I'm doing wrong ?
exports.createBranch = function (req, res) {
var branchName = req.body["branch_name"];
var name = req.body["name"];
var email = req.body["email"];
var message = "branch {0} created".format(branchName);
NodeGit.Repository.open(config.database).then(function (repo) {
return repo.getHeadCommit();
}).then(function (commit) {
var signature = NodeGit.Signature.now(name, email);
return repo.createBranch(branchName, commit, 0, signature, message);
}).then(function (branch) {
console.log(branch);
res.status(200).json({message: "OK", data: branch.toString()});
}).catch(function (err) {
res.status(500).json({message: err, data: []});
}).done(function () {
console.log("finished");
});
};
The line res.status(500).json({message: err, data: []}); gets called with an empty err object "{}".
Activity
demian85 commentedon Apr 2, 2014
up! (?)
tbranyen commentedon Apr 2, 2014
http://www.nodegit.org/nodegit/#Branch-create
sameoldmadness commentedon Apr 5, 2014
Should
require("nodegit").Branchbeundefined?I'm a bit confused about not finding any mention of branches in nodegit's js codebase.
tbranyen commentedon Apr 5, 2014
@sameoldmadness Interesting, looks like it is stripped from the binding.gyp file. We should try and get that included, thanks for catching it.
leileichrist commentedon Jun 29, 2016
I'm trying to create a branch using the Repository#createBranch method but it throws an empty error "{}". Could you guys take a look at what I'm doing wrong ?
The line
res.status(500).json({message: err, data: []});gets called with an empty err object "{}".