@@ -8,6 +8,9 @@ describe("Revwalk", function() {
88 var Revwalk = require ( "../../lib/revwalk" ) ;
99 var Oid = require ( "../../lib/oid" ) ;
1010
11+ // Set a reasonable timeout here now that our repository has grown.
12+ this . timeout ( 150000 ) ;
13+
1114 before ( function ( done ) {
1215 var test = this ;
1316 return Repository . open ( reposPath ) . then ( function ( repository ) {
@@ -81,34 +84,31 @@ describe("Revwalk", function() {
8184 } ) ;
8285 } ) ;
8386
84- // This test requires forcing garbage collection, so mocha needs to be run via
85- // node rather than npm, with a la `node --expose-gc [pathtohmoca] [testglob]`
86- var testGC = ( global . gc ? it : it . skip ) ;
87+ // This test requires forcing garbage collection, so mocha needs to be run
88+ // via node rather than npm, with a la `node --expose-gc [pathtohmoca]
89+ // [testglob]`
90+ var testGC = global . gc ? it : it . skip ;
8791
8892 testGC ( "doesnt segfault when accessing .author() twice" , function ( done ) {
89- this . timeout ( 10000 ) ;
90-
91- return Repository . open ( reposPath ) . then ( function ( repository ) {
93+ Repository . open ( reposPath ) . then ( function ( repository ) {
9294 var walker = repository . createRevWalk ( ) ;
93- return repository . getMasterCommit ( ) . then ( function ( firstCommitOnMaster ) {
94- var did = false ;
95- walker . walk ( firstCommitOnMaster , function ( error , commit ) {
95+
96+ repository . getMasterCommit ( ) . then ( function ( firstCommitOnMaster ) {
97+ walker . walk ( firstCommitOnMaster , function ( err , commit ) {
98+ if ( ! err && ! commit ) {
99+ return done ( ) ;
100+ }
101+
96102 for ( var i = 0 ; i < 1000 ; i ++ ) {
97- if ( true ) {
103+ ( function ( ) {
98104 commit . author ( ) . name ( ) ;
99105 commit . author ( ) . email ( ) ;
100- }
101- global . gc ( ) ;
102- }
103- if ( ! did ) {
104- done ( ) ;
105- did = true ;
106+
107+ global . gc ( ) ;
108+ } ) ( ) ;
106109 }
107110 } ) ;
108111 } ) ;
109- } ) . then ( function ( ) {
110- global . gc ( ) ;
111112 } ) ;
112113 } ) ;
113-
114114} ) ;
0 commit comments