@@ -16,6 +16,11 @@ public class RebaseFixture : BaseFixture
16
16
const string conflictBranch1Name = "C1" ;
17
17
const string topicBranch1PrimeName = "T1Prime" ;
18
18
19
+ string filePathA = "a.txt" ;
20
+ string filePathB = "b.txt" ;
21
+ string filePathC = "c.txt" ;
22
+ string filePathD = "d.txt" ;
23
+
19
24
[ Theory ]
20
25
[ InlineData ( topicBranch2Name , topicBranch2Name , topicBranch1Name , masterBranch1Name , 3 ) ]
21
26
[ InlineData ( topicBranch2Name , topicBranch2Name , topicBranch1Name , topicBranch1Name , 3 ) ]
@@ -310,9 +315,6 @@ public void CanContinueRebase()
310
315
Assert . Equal ( 0 , afterStepCallCount ) ;
311
316
Assert . True ( wasCheckoutProgressCalled , "CheckoutProgress callback was not called." ) ;
312
317
313
- // TODO: investigate following statement.
314
- // Assert.True(wasCheckoutNotifyCalled, "CheckoutNotify callback was not called.");
315
-
316
318
// Resolve the conflict
317
319
foreach ( Conflict conflict in repo . Index . Conflicts )
318
320
{
@@ -342,6 +344,55 @@ public void CanContinueRebase()
342
344
}
343
345
}
344
346
347
+ [ Fact ]
348
+ public void ContinuingRebaseWithUnstagedChangesThrows ( )
349
+ {
350
+ SelfCleaningDirectory scd = BuildSelfCleaningDirectory ( ) ;
351
+ var path = Repository . Init ( scd . DirectoryPath ) ;
352
+ using ( Repository repo = new Repository ( path ) )
353
+ {
354
+ ConstructRebaseTestRepository ( repo ) ;
355
+
356
+ repo . Checkout ( topicBranch1Name ) ;
357
+ Assert . False ( repo . RetrieveStatus ( ) . IsDirty ) ;
358
+
359
+ Branch branch = repo . Branches [ topicBranch1Name ] ;
360
+ Branch upstream = repo . Branches [ conflictBranch1Name ] ;
361
+ Branch onto = repo . Branches [ conflictBranch1Name ] ;
362
+
363
+ RebaseResult rebaseResult = repo . Rebase . Start ( branch , upstream , onto , Constants . Identity , null ) ;
364
+
365
+ // Verify that we have a conflict.
366
+ Assert . Equal ( CurrentOperation . RebaseMerge , repo . Info . CurrentOperation ) ;
367
+ Assert . Equal ( RebaseStatus . Conflicts , rebaseResult . Status ) ;
368
+ Assert . True ( repo . RetrieveStatus ( ) . IsDirty ) ;
369
+ Assert . False ( repo . Index . IsFullyMerged ) ;
370
+ Assert . Equal ( 0 , rebaseResult . CompletedStepCount ) ;
371
+ Assert . Equal ( 3 , rebaseResult . TotalStepCount ) ;
372
+
373
+ Assert . Throws < UnmergedIndexEntriesException > ( ( ) =>
374
+ repo . Rebase . Continue ( Constants . Identity , null ) ) ;
375
+
376
+ // Resolve the conflict
377
+ foreach ( Conflict conflict in repo . Index . Conflicts )
378
+ {
379
+ Touch ( repo . Info . WorkingDirectory ,
380
+ conflict . Theirs . Path ,
381
+ repo . Lookup < Blob > ( conflict . Theirs . Id ) . GetContentText ( new FilteringOptions ( conflict . Theirs . Path ) ) ) ;
382
+ repo . Stage ( conflict . Theirs . Path ) ;
383
+ }
384
+
385
+ Touch ( repo . Info . WorkingDirectory ,
386
+ filePathA ,
387
+ "Unstaged content" ) ;
388
+
389
+ Assert . Throws < UnmergedIndexEntriesException > ( ( ) =>
390
+ repo . Rebase . Continue ( Constants . Identity , null ) ) ;
391
+
392
+ Assert . True ( repo . Index . IsFullyMerged ) ;
393
+ }
394
+ }
395
+
345
396
[ Fact ]
346
397
public void CanQueryRebaseOperation ( )
347
398
{
@@ -571,22 +622,18 @@ private void ConstructRebaseTestRepository(Repository repo)
571
622
// ---*
572
623
// |
573
624
// C1
574
- string filePathA = "a.txt" ;
575
625
const string fileContentA1 = "A1" ;
576
626
577
- string filePathB = "b.txt" ;
578
627
const string fileContentB1 = "B1" ;
579
628
const string fileContentB2 = "B2" ;
580
629
const string fileContentB3 = "B3" ;
581
630
const string fileContentB4 = "B4" ;
582
631
583
- string filePathC = "c.txt" ;
584
632
const string fileContentC1 = "C1" ;
585
633
const string fileContentC2 = "C2" ;
586
634
const string fileContentC3 = "C3" ;
587
635
const string fileContentC4 = "C4" ;
588
636
589
- string filePathD = "d.txt" ;
590
637
const string fileContentD1 = "D1" ;
591
638
const string fileContentD2 = "D2" ;
592
639
const string fileContentD3 = "D3" ;
0 commit comments