@@ -191,17 +191,48 @@ public void VerifyRebaseDetailed()
191
191
Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
192
192
193
193
bool wasCheckoutProgressCalled = false ;
194
+ bool wasCheckoutProgressCalledForResetingHead = false ;
194
195
bool wasCheckoutNotifyCalled = false ;
196
+ bool wasCheckoutNotifyCalledForResetingHead = false ;
197
+
198
+ bool startedApplyingSteps = false ;
195
199
196
200
RebaseOptions options = new RebaseOptions ( )
197
201
{
198
- OnCheckoutProgress = ( x , y , z ) => wasCheckoutProgressCalled = true ,
199
- OnCheckoutNotify = ( x , y ) => { wasCheckoutNotifyCalled = true ; return true ; } ,
202
+ OnCheckoutProgress = ( x , y , z ) =>
203
+ {
204
+ if ( startedApplyingSteps )
205
+ {
206
+ wasCheckoutProgressCalled = true ;
207
+ }
208
+ else
209
+ {
210
+ wasCheckoutProgressCalledForResetingHead = true ;
211
+ }
212
+ } ,
213
+ OnCheckoutNotify = ( x , y ) =>
214
+ {
215
+ if ( startedApplyingSteps )
216
+ {
217
+ wasCheckoutNotifyCalled = true ;
218
+ }
219
+ else
220
+ {
221
+ wasCheckoutNotifyCalledForResetingHead = true ;
222
+ }
223
+
224
+ return true ;
225
+ } ,
200
226
CheckoutNotifyFlags = CheckoutNotifyFlags . Updated ,
227
+
228
+ RebaseStepStarting = x => startedApplyingSteps = true ,
229
+
201
230
} ;
202
231
203
232
repo . Rebase . Start ( null , upstreamBranch , null , Constants . Signature2 , options ) ;
204
233
234
+ Assert . Equal ( true , wasCheckoutNotifyCalledForResetingHead ) ;
235
+ Assert . Equal ( true , wasCheckoutProgressCalledForResetingHead ) ;
205
236
Assert . Equal ( true , wasCheckoutNotifyCalled ) ;
206
237
Assert . Equal ( true , wasCheckoutProgressCalled ) ;
207
238
@@ -261,7 +292,7 @@ public void CanContinueRebase()
261
292
RebaseStepCompleted = x => afterStepCallCount ++ ,
262
293
OnCheckoutProgress = ( x , y , z ) => wasCheckoutProgressCalled = true ,
263
294
OnCheckoutNotify = ( x , y ) => { wasCheckoutNotifyCalled = true ; return true ; } ,
264
- CheckoutNotifyFlags = CheckoutNotifyFlags . Updated | CheckoutNotifyFlags . Conflict ,
295
+ CheckoutNotifyFlags = CheckoutNotifyFlags . Updated ,
265
296
} ;
266
297
267
298
RebaseResult rebaseResult = repo . Rebase . Start ( branch , upstream , onto , Constants . Signature , options ) ;
@@ -368,10 +399,24 @@ public void CanAbortRebase()
368
399
Assert . Equal ( 0 , rebaseResult . CompletedStepCount ) ;
369
400
Assert . Equal ( 3 , rebaseResult . TotalStepCount ) ;
370
401
371
- repo . Rebase . Abort ( ) ;
372
- Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
373
- Assert . True ( repo . Index . IsFullyMerged ) ;
402
+ // Set up the callbacks to verify that checkout progress / notify
403
+ // callbacks are called.
404
+ bool wasCheckoutProgressCalled = false ;
405
+ bool wasCheckoutNotifyCalled = false ;
406
+ RebaseOptions options = new RebaseOptions ( )
407
+ {
408
+ OnCheckoutProgress = ( x , y , z ) => wasCheckoutProgressCalled = true ,
409
+ OnCheckoutNotify = ( x , y ) => { wasCheckoutNotifyCalled = true ; return true ; } ,
410
+ CheckoutNotifyFlags = CheckoutNotifyFlags . Updated ,
411
+ } ;
412
+
413
+ repo . Rebase . Abort ( options ) ;
414
+ Assert . False ( repo . RetrieveStatus ( ) . IsDirty , "Repository workdir is dirty after Rebase.Abort." ) ;
415
+ Assert . True ( repo . Index . IsFullyMerged , "Repository index is not fully merged after Rebase.Abort." ) ;
374
416
Assert . Equal ( CurrentOperation . None , repo . Info . CurrentOperation ) ;
417
+
418
+ Assert . True ( wasCheckoutProgressCalled , "Checkout progress callback was not called during Rebase.Abort." ) ;
419
+ Assert . True ( wasCheckoutNotifyCalled , "Checkout notify callback was not called during Rebase.Abort." ) ;
375
420
}
376
421
}
377
422
0 commit comments