@@ -9,7 +9,7 @@ import http from 'isomorphic-git/http/web'
99import FS from '@isomorphic-git/lightning-fs'
1010import Html from '../serializers/Html'
1111import {
12- FileUnreadableError ,
12+ FileUnreadableError , GitPushError ,
1313 MissingPermissionsError ,
1414 ResourceLockedError ,
1515 SlashError
@@ -133,7 +133,7 @@ export default class GitAdapter extends CachingAdapter {
133133 await git . renameBranch ( { fs : this . fs , dir : this . dir , ref : this . server . branch , oldref : currentBranch } )
134134 }
135135 Logger . log ( '(git) push' )
136- await git . push ( {
136+ const result = await git . push ( {
137137 fs : this . fs ,
138138 http,
139139 dir : this . dir ,
@@ -142,6 +142,9 @@ export default class GitAdapter extends CachingAdapter {
142142 remote : 'origin' ,
143143 onAuth : ( ) => this . onAuth ( )
144144 } )
145+ if ( result . error ) {
146+ throw new GitPushError ( result . error )
147+ }
145148 } else {
146149 throw e
147150 }
@@ -203,19 +206,23 @@ export default class GitAdapter extends CachingAdapter {
203206 } )
204207 try {
205208 Logger . log ( '(git) push' )
206- await git . push ( {
209+ const result = await git . push ( {
207210 fs : this . fs ,
208211 http,
209212 dir : this . dir ,
210213 remote : 'origin' ,
211214 force : true ,
212215 onAuth : ( ) => this . onAuth ( )
213216 } )
217+ if ( result . error ) {
218+ throw new GitPushError ( result . error )
219+ }
214220 } catch ( e ) {
215221 if ( e . code && e . code === git . Errors . PushRejectedError . code ) {
216222 await this . freeLock ( ) // Only clears the locks set in the current adapter instance
217223 throw new ResourceLockedError
218224 }
225+ throw e
219226 }
220227 } else {
221228 Logger . log ( 'No changes to the server version necessary' )
@@ -244,7 +251,10 @@ export default class GitAdapter extends CachingAdapter {
244251 Logger . log ( '(git) tag ' + tag )
245252 await git . tag ( { fs : this . fs , dir : this . dir , ref : tag } )
246253 Logger . log ( '(git) push tag ' + tag )
247- await git . push ( { fs : this . fs , http, dir : this . dir , ref : tag , onAuth : ( ) => this . onAuth ( ) } )
254+ const result = await git . push ( { fs : this . fs , http, dir : this . dir , ref : tag , onAuth : ( ) => this . onAuth ( ) } )
255+ if ( result . error ) {
256+ throw new GitPushError ( result . error )
257+ }
248258 this . locked . push ( tag )
249259 } ) ( )
250260 await this . lockingPromise
@@ -265,6 +275,7 @@ export default class GitAdapter extends CachingAdapter {
265275 try {
266276 for ( const tag of this . locked ) {
267277 Logger . log ( '(git) push: delete tag ' + tag )
278+ // Ignoring result.error
268279 await git . push ( { fs : this . fs , http, dir : this . dir , ref : tag , delete : true , onAuth : ( ) => this . onAuth ( ) } )
269280 }
270281 this . locked = [ ]
@@ -281,6 +292,7 @@ export default class GitAdapter extends CachingAdapter {
281292 const tags = await git . listTags ( { fs, dir : this . dir } )
282293 const lockTags = tags . filter ( tag => tag . startsWith ( 'floccus-lock-' ) )
283294 for ( const tag of lockTags ) {
295+ // ignoring result.error
284296 await git . push ( { fs, http, dir : this . dir , ref : tag , delete : true , onAuth : ( ) => this . onAuth ( ) } )
285297 }
286298 }
@@ -359,7 +371,7 @@ export default class GitAdapter extends CachingAdapter {
359371 if ( currentBranch && currentBranch !== this . server . branch ) {
360372 await git . renameBranch ( { fs, dir : this . dir , ref : this . server . branch , oldref : currentBranch } )
361373 }
362- await git . push ( {
374+ const result = await git . push ( {
363375 fs,
364376 http,
365377 dir : this . dir ,
@@ -369,6 +381,9 @@ export default class GitAdapter extends CachingAdapter {
369381 force : true ,
370382 onAuth : ( ) => this . onAuth ( )
371383 } )
384+ if ( result . error ) {
385+ throw new GitPushError ( result . error )
386+ }
372387 await git . fetch ( {
373388 http,
374389 fs,
0 commit comments