File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,8 +63,14 @@ TreeEntry.prototype.getTree = function(callback) {
6363 * Retrieve the tree for this entry. Make sure to call `isTree` first!
6464 * @return {Blob }
6565 */
66- TreeEntry . prototype . getBlob = function ( ) {
67- return this . parent . repo . getBlob ( this . oid ( ) ) ;
66+ TreeEntry . prototype . getBlob = function ( callback ) {
67+ return this . parent . repo . getBlob ( this . oid ( ) ) . then ( function ( blob ) {
68+ if ( typeof callback === "function" ) {
69+ callback ( null , blob ) ;
70+ }
71+
72+ return blob ;
73+ } , callback ) ;
6874} ;
6975
7076/**
Original file line number Diff line number Diff line change @@ -54,6 +54,15 @@ describe("TreeEntry", function() {
5454 } ) ;
5555 } ) ;
5656
57+ it ( "provides the blob representation via callback" , function ( ) {
58+ return this . commit . getEntry ( "test/raw-commit.js" )
59+ . then ( function ( entry ) {
60+ entry . getBlob ( function ( error , blob ) {
61+ assert . equal ( blob . rawsize ( ) , 2736 ) ;
62+ } ) ;
63+ } ) ;
64+ } ) ;
65+
5766 it ( "provides the tree the entry is part of" , function ( ) {
5867 return this . commit . getEntry ( "test" )
5968 . then ( function ( entry ) {
You can’t perform that action at this time.
0 commit comments