Skip to content

Commit 9c06b9f

Browse files
committed
Added oid to api
1 parent 53d64cd commit 9c06b9f

3 files changed

Lines changed: 23 additions & 4 deletions

File tree

example/convenience-repo.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ git.repo( './dummyrepo/.git', function( err, path, repo ) {
1515
console.log( author.email );
1616
});
1717

18-
repo.head( 'master', function( err ) {
19-
20-
console.log( err );
21-
18+
repo.head( 'master', function( err, path, head ) {
19+
git.commit( head ).author().name;
2220
});
2321
});

example/dummyrepo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 2f6cbe055f1a6ca0a3ba524ba88a7806ba507a89

lib/oid.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var git = require( '../' );
2+
3+
var _Oid = function( obj ) {
4+
var self = {};
5+
6+
if( obj instanceof git.git2.Oid ) {
7+
self.oid = obj;
8+
}
9+
else {
10+
self.oid = new git.git2.Oid();
11+
12+
if( typeof obj === 'string' ) {
13+
self.oid.mkstr( obj );
14+
}
15+
}
16+
17+
return self;
18+
};
19+
20+
exports.oid = _Oid;

0 commit comments

Comments
 (0)