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
var path = require('path');
var GitService = function () {
this.open = require("nodegit").Repo.open;
};
GitService.prototype = {
log: function (repo, count, callback) {
this.open('/home/joshua/skyduel/.git', function(error, repo) {
if (error) throw error;
console.log('repo opened', repo);
});
}
};
module.exports = GitService;
Console output when I run my wrapper application:
repo opened {}
Any ideas? I know for sure that the repo being requested exists, is freshly populated, and I can do git status on it and receive proper information.
Here is console output showing the git repo is properly initialized:
joshua@joshua-VirtualBox:~/skyduel$ pwd
/home/joshua/skyduel
joshua@joshua-VirtualBox:~/skyduel$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
joshua@joshua-VirtualBox:~/skyduel$ npm list -g | grep nodegit
├─┬ nodegit@0.1.4
joshua@joshua-VirtualBox:~/skyduel$
Thanks for responding so quickly! I'm rather confused then. There is no 'Repository' object or even a 'Repo.open' method but the Readme.md for the nodegit project states there should be? Am I viewing an old Readme?
this.open = require("nodegit").Repository.open;
^
TypeError: Cannot read property 'open' of undefined
at Object.GitService (/media/sf_dev/node/pomelo/skyduel/game-server/GitService.js:4:48)
at Object.<anonymous> (/media/sf_dev/node/pomelo/skyduel/game-server/app.js:8:16)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Also, did the promise library get removed? I'm trying to follow examples with '.then()' but they are causing issues.saying I need to provide a callback function instead.
Activity
tbranyen commentedon Oct 14, 2014
This isn't an error, it's returning you a repo Object. You would log
repo.__proto__to see its available methods.joshjung commentedon Oct 14, 2014
Thanks for responding so quickly! I'm rather confused then. There is no 'Repository' object or even a 'Repo.open' method but the Readme.md for the nodegit project states there should be? Am I viewing an old Readme?
Also, did the promise library get removed? I'm trying to follow examples with '.then()' but they are causing issues.saying I need to provide a callback function instead.
tbranyen commentedon Oct 14, 2014
My guess is that NodeGit isn't installed correctly. Are you running master, the docs are for the current master branch.