Created
October 13, 2014 21:38
-
-
Save probablycorey/438c27d57d5e287ab8bb to your computer and use it in GitHub Desktop.
Nodegit bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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