@@ -52,10 +52,13 @@ fse.remove(path.resolve(__dirname, repoDir))
5252 return repository . refreshIndex ( ) ;
5353} )
5454. then ( function ( index ) {
55- index . addByPath ( fileName ) ;
56- index . write ( ) ;
57-
58- return index . writeTree ( ) ;
55+ return index . addByPath ( fileName )
56+ . then ( function ( ) {
57+ return index . write ( ) ;
58+ } )
59+ . then ( function ( ) {
60+ return index . writeTree ( ) ;
61+ } ) ;
5962} )
6063. then ( function ( oid ) {
6164 return repository . createCommit ( "HEAD" , baseSignature ,
@@ -95,10 +98,13 @@ fse.remove(path.resolve(__dirname, repoDir))
9598. then ( function ( ) {
9699 return repository . refreshIndex ( )
97100 . then ( function ( index ) {
98- index . addByPath ( fileName ) ;
99- index . write ( ) ;
100-
101- return index . writeTree ( ) ;
101+ return index . addByPath ( fileName )
102+ . then ( function ( ) {
103+ return index . write ( ) ;
104+ } )
105+ . then ( function ( ) {
106+ return index . writeTree ( ) ;
107+ } ) ;
102108 } ) ;
103109} )
104110. then ( function ( oid ) {
@@ -120,11 +126,15 @@ fse.remove(path.resolve(__dirname, repoDir))
120126 ) ;
121127} )
122128. then ( function ( ) {
123- return repository . refreshIndex ( ) . then ( function ( index ) {
124- index . addByPath ( fileName ) ;
125- index . write ( ) ;
126-
127- return index . writeTree ( ) ;
129+ return repository . refreshIndex ( )
130+ . then ( function ( index ) {
131+ return index . addByPath ( fileName )
132+ . then ( function ( ) {
133+ return index . write ( ) ;
134+ } )
135+ . then ( function ( ) {
136+ return index . writeTree ( ) ;
137+ } ) ;
128138 } ) ;
129139} )
130140. then ( function ( oid ) {
@@ -170,12 +180,15 @@ fse.remove(path.resolve(__dirname, repoDir))
170180// we need to get a new index as the other one isnt backed to
171181// the repository in the usual fashion, and just behaves weirdly
172182. then ( function ( ) {
173- return repository . refreshIndex ( ) . then ( function ( index ) {
174-
175- index . addByPath ( fileName ) ;
176- index . write ( ) ;
177-
178- return index . writeTree ( ) ;
183+ return repository . refreshIndex ( )
184+ . then ( function ( index ) {
185+ return index . addByPath ( fileName )
186+ . then ( function ( ) {
187+ return index . write ( ) ;
188+ } )
189+ . then ( function ( ) {
190+ return index . writeTree ( ) ;
191+ } ) ;
179192 } ) ;
180193} )
181194. then ( function ( oid ) {
0 commit comments