1- var git = require ( '../' ) ,
2- RevWalk = git . Revwalk ;
1+ var git = require ( '../' ) ;
2+ var util = require ( './util' ) ;
3+ var Revwalk = git . Revwalk ;
34
45// Backwards compatibility.
56Object . defineProperty ( git , "RevWalk" , {
6- value : RevWalk ,
7+ value : Revwalk ,
78 enumerable : false
89} ) ;
910
10- var oldSorting = RevWalk . prototype . sorting ;
11+ var oldSorting = Revwalk . prototype . sorting ;
1112
1213/**
1314 * Refer to vendor/libgit2/include/git2/revwalk.h for sort definitions.
1415 */
15- RevWalk . Sort = {
16+ Revwalk . Sort = {
1617 None : 0 ,
1718 Topological : 1 ,
1819 Time : 2 ,
@@ -25,7 +26,7 @@ RevWalk.Sort = {
2526 *
2627 * @param {Number } sort
2728 */
28- RevWalk . prototype . sorting = function ( ) {
29+ Revwalk . prototype . sorting = function ( ) {
2930 var sort = 0 ;
3031 for ( var i = 0 ; i < arguments . length ; i ++ )
3132 sort |= arguments [ i ] ;
@@ -40,25 +41,28 @@ RevWalk.prototype.sorting = function() {
4041 * @param {Function } callback
4142 * @return {Commit }
4243 */
43- RevWalk . prototype . walk = function ( oid , callback ) {
44+ Revwalk . prototype . walk = function ( oid , callback ) {
4445 var self = this ;
45- console . log ( this ) ;
46- //this.push(oid, function revWalkPush(error) {
47- //if (error) return callback(error);
4846
49- //function walk() {
50- // self.next(function revWalkNext(error, oid) {
51- // if (error) return callback(error);
52- // if (!oid) return callback();
47+ this . push ( oid , function revWalkPush ( error ) {
48+ if ( error ) return callback ( error ) ;
5349
54- // self.repo.getCommit(oid, function revWalkCommitLookup(error, commit) {
55- // if (error) return callback(error);
50+ function walk ( ) {
51+ self . next ( function revWalkNext ( error , oid ) {
52+ if ( error ) return callback ( error ) ;
53+ if ( ! oid ) return callback ( ) ;
5654
57- // callback(null, commit);
58- // walk();
59- // });
60- // });
61- //}
62- //walk();
63- //});
55+ self . repo . getCommit ( oid , function revWalkCommitLookup ( error , commit ) {
56+ if ( error ) return callback ( error ) ;
57+
58+ callback ( null , commit ) ;
59+ walk ( ) ;
60+ } ) ;
61+ } ) ;
62+ }
63+
64+ walk ( ) ;
65+ } ) ;
6466} ;
67+ util . normalizeOid ( Revwalk . prototype , 'getTag' ) ;
68+ util . makeSafe ( Revwalk . prototype , 'getTag' ) ;
0 commit comments