@@ -1656,6 +1656,7 @@ public void Stage(IEnumerable<string> paths, StageOptions stageOptions)
16561656 . Where (
16571657 tec => tec . Status != ChangeKind . Added &&
16581658 tec . Status != ChangeKind . Modified &&
1659+ tec . Status != ChangeKind . Conflicted &&
16591660 tec . Status != ChangeKind . Unmodified &&
16601661 tec . Status != ChangeKind . Deleted ) . ToList ( ) ;
16611662
@@ -1667,10 +1668,25 @@ public void Stage(IEnumerable<string> paths, StageOptions stageOptions)
16671668 unexpectedTypesOfChanges [ 0 ] . Path , unexpectedTypesOfChanges [ 0 ] . Status ) ) ;
16681669 }
16691670
1670- foreach ( TreeEntryChanges treeEntryChanges in changes
1671- . Where ( tec => tec . Status == ChangeKind . Deleted ) )
1671+ /* Remove files from the index that don't exist on disk */
1672+ foreach ( TreeEntryChanges treeEntryChanges in changes )
16721673 {
1673- RemoveFromIndex ( treeEntryChanges . Path ) ;
1674+ switch ( treeEntryChanges . Status )
1675+ {
1676+ case ChangeKind . Conflicted :
1677+ if ( ! treeEntryChanges . Exists )
1678+ {
1679+ RemoveFromIndex ( treeEntryChanges . Path ) ;
1680+ }
1681+ break ;
1682+
1683+ case ChangeKind . Deleted :
1684+ RemoveFromIndex ( treeEntryChanges . Path ) ;
1685+ break ;
1686+
1687+ default :
1688+ continue ;
1689+ }
16741690 }
16751691
16761692 foreach ( TreeEntryChanges treeEntryChanges in changes )
@@ -1682,6 +1698,13 @@ public void Stage(IEnumerable<string> paths, StageOptions stageOptions)
16821698 AddToIndex ( treeEntryChanges . Path ) ;
16831699 break ;
16841700
1701+ case ChangeKind . Conflicted :
1702+ if ( treeEntryChanges . Exists )
1703+ {
1704+ AddToIndex ( treeEntryChanges . Path ) ;
1705+ }
1706+ break ;
1707+
16851708 default :
16861709 continue ;
16871710 }
0 commit comments