-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Description
It would be great to get some sort of "rev-parse" functionality that you could pass any revision identifier to and have it resolve to a SHA hash. Maybe something like:
// Resolve 'HEAD', asynchronous
repo.revParse("HEAD", function(err, sha) {
if (err) throw err;
repo.getCommit(sha, function(err, commit) {
// Blah
});
});
// Resolve the tag 'v1.0.0', synchronous
var sha = repo.revParse("v1.0.0");
// Resolve to an oid and get raw Buffer
repo.getRawObject(repo.revParse("HEAD:package.json")).data;
// This would be awesome too:
// All should return: 37d671c8470ca723b951d25dd882186ec6c65c28
repo.revParse("37d671c8470ca723b951d25d");
repo.revParse("37d671c8470ca72");
repo.revParse("37d671c");
Thoughts?