Skip to content

Instantly share code, notes, and snippets.

@probablycorey
Created October 13, 2014 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save probablycorey/438c27d57d5e287ab8bb to your computer and use it in GitHub Desktop.
Save probablycorey/438c27d57d5e287ab8bb to your computer and use it in GitHub Desktop.
Nodegit bug
var git = require('nodegit');
var repo = null;
var repoPath = process.argv[2]
if(!repoPath) {
console.log("Usage: node nodegit-bug.js PATH_GIT_REPO")
process.exit(1)
}
git.Repository.open(repoPath)
.then(function(r) {
repo = r;
return repo.getReference("refs/heads/master");
})
.then(function(reference) {
var revWalk;
revWalk = repo.createRevWalk();
revWalk.walk(reference.target(), function(error, commit) {
if (error) {
console.error(error);
process.exit(1);
}
console.log(commit.author().email());
console.log(commit.author().name());
});
})
.catch(function(error) {
console.log(error.stack || error);
document.body.textContent = "Failure: " + (error.stack || error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment