@@ -10,27 +10,26 @@ var _Repo = function( path, callback ) {
1010 // Internal reference to a Git repository
1111 self . repo = new git . git2 . Repo ( ) ;
1212
13- // Work with a specific branch
14- //self.branch = function( name, callback ) {
15- // var branch = new git.git2.Ref( self.repo );
16- //
17- // self.repo.lookupRef( branch, 'refs/heads/'+ name, function() {
18- // var args = Array.prototype.slice.call( arguments );
19- // args[0] = git.error().toString( args[0] );
20- // callback.apply( branch, args.concat( branch ) );
21- // });
22- //};
13+ // Work with a specific head reference
14+ self . head = function ( name , callback ) {
15+ var head = git . ref ( self . repo ) ;
16+
17+ self . repo . lookupRef ( head . ref , 'refs/heads/' + name , function ( ) {
18+ var args = Array . prototype . slice . call ( arguments ) ;
19+ args [ 0 ] = git . error ( ) . toString ( args [ 0 ] ) ;
20+
21+ callback . apply ( head , args . concat ( head ) ) ;
22+ } ) ;
23+ } ;
2324
2425 // Find a single commit
2526 self . commit = function ( sha , callback ) {
26- var oid = new git . git2 . Oid ( ) ;
27+ var oid = git . oid ( sha ) ;
2728
2829 if ( ! callback ) { return ; }
2930
30- oid . mkstr ( sha ) ;
31-
3231 var commit = git . commit ( self . repo ) ;
33- commit . lookup ( oid , callback ) ;
32+ commit . lookup ( oid . oid , callback ) ;
3433 } ;
3534
3635 //self.find = function( name, callback ) {
0 commit comments