@@ -2,8 +2,8 @@ var promisify = require("promisify-node");
22var fs = promisify ( "fs" ) ;
33
44// Have to wrap exec, since it has a weird callback signature.
5- var exec = promisify ( function ( command , callback ) {
6- return require ( "child_process" ) . exec ( command , callback ) ;
5+ var exec = promisify ( function ( command , opts , callback ) {
6+ return require ( "child_process" ) . exec ( command , opts , callback ) ;
77} ) ;
88
99before ( function ( done ) {
@@ -12,17 +12,24 @@ before(function(done) {
1212 var url = "https://github.com/nodegit/test" ;
1313 var done = done . bind ( null , null ) ;
1414
15- fs . exists ( "test/repos" ) . then ( function ( ) {
16- return fs . mkdir ( "test/repos" ) . then ( function ( ) {
17- return exec ( "git init test/repos/empty" ) ;
18- } ) . then ( function ( ) {
15+ function initEmpty ( ) {
16+ return exec ( "git init test/repos/empty" ) ;
17+ }
18+
19+ fs . mkdir ( "test/repos" ) . then ( initEmpty , initEmpty )
20+ . then ( function ( ) {
1921 return exec ( "git clone " + url + " test/repos/workdir" ) ;
22+ } ) . then ( function ( ) {
23+ return exec ( "git checkout rev-walk" , { cwd : "test/repos/workdir" } )
24+ } ) . then ( function ( ) {
25+ return exec ( "git checkout master" , { cwd : "test/repos/workdir" } )
2026 } ) . then ( function ( ) {
2127 var nonrepo = "test/repos/nonrepo" ;
2228
23- return fs . mkdir ( nonrepo ) . then ( function ( ) {
29+ function writeBogus ( ) {
2430 return fs . writeFile ( nonrepo + "/file.txt" , "This is a bogus file" ) ;
25- } ) ;
26- } )
27- } ) . then ( done , done ) ;
31+ }
32+
33+ return fs . mkdir ( nonrepo ) . then ( writeBogus , writeBogus ) ;
34+ } ) . then ( done , done ) ;
2835} ) ;
0 commit comments