@@ -99,38 +99,23 @@ public bool UseAmend
9999 }
100100 }
101101
102- public string UnstagedFilter
102+ public string Filter
103103 {
104- get => _unstagedFilter ;
104+ get => _filter ;
105105 set
106106 {
107- if ( SetProperty ( ref _unstagedFilter , value ) )
107+ if ( SetProperty ( ref _filter , value ) )
108108 {
109109 if ( _isLoadingData )
110110 return ;
111111
112- VisibleUnstaged = GetVisibleChanges ( _unstaged , _unstagedFilter ) ;
112+ VisibleUnstaged = GetVisibleChanges ( _unstaged ) ;
113+ VisibleStaged = GetVisibleChanges ( _staged ) ;
113114 SelectedUnstaged = [ ] ;
114115 }
115116 }
116117 }
117118
118- public string StagedFilter
119- {
120- get => _stagedFilter ;
121- set
122- {
123- if ( SetProperty ( ref _stagedFilter , value ) )
124- {
125- if ( _isLoadingData )
126- return ;
127-
128- VisibleStaged = GetVisibleChanges ( _staged , _stagedFilter ) ;
129- SelectedStaged = [ ] ;
130- }
131- }
132- }
133-
134119 public List < Models . Change > Unstaged
135120 {
136121 get => _unstaged ;
@@ -294,7 +279,7 @@ public void SetData(List<Models.Change> changes)
294279 }
295280 }
296281
297- var visibleUnstaged = GetVisibleChanges ( unstaged , _unstagedFilter ) ;
282+ var visibleUnstaged = GetVisibleChanges ( unstaged ) ;
298283 var selectedUnstaged = new List < Models . Change > ( ) ;
299284 foreach ( var c in visibleUnstaged )
300285 {
@@ -304,7 +289,7 @@ public void SetData(List<Models.Change> changes)
304289
305290 var staged = GetStagedChanges ( ) ;
306291
307- var visibleStaged = GetVisibleChanges ( staged , _stagedFilter ) ;
292+ var visibleStaged = GetVisibleChanges ( staged ) ;
308293 var selectedStaged = new List < Models . Change > ( ) ;
309294 foreach ( var c in visibleStaged )
310295 {
@@ -374,14 +359,9 @@ public void Discard(List<Models.Change> changes)
374359 _repo . ShowPopup ( new Discard ( _repo , changes ) ) ;
375360 }
376361
377- public void ClearUnstagedFilter ( )
378- {
379- UnstagedFilter = string . Empty ;
380- }
381-
382- public void ClearStagedFilter ( )
362+ public void ClearFilter ( )
383363 {
384- StagedFilter = string . Empty ;
364+ Filter = string . Empty ;
385365 }
386366
387367 public async void UseTheirs ( List < Models . Change > changes )
@@ -571,11 +551,6 @@ public void CommitWithPush()
571551 DoCommit ( false , true , false ) ;
572552 }
573553
574- public void CommitWithoutFiles ( bool autoPush )
575- {
576- DoCommit ( false , autoPush , true ) ;
577- }
578-
579554 public ContextMenu CreateContextMenuForUnstagedChanges ( )
580555 {
581556 if ( _selectedUnstaged == null || _selectedUnstaged . Count == 0 )
@@ -1505,16 +1480,16 @@ public ContextMenu CreateContextForOpenAI()
15051480 return menu ;
15061481 }
15071482
1508- private List < Models . Change > GetVisibleChanges ( List < Models . Change > changes , string filter )
1483+ private List < Models . Change > GetVisibleChanges ( List < Models . Change > changes )
15091484 {
1510- if ( string . IsNullOrEmpty ( filter ) )
1485+ if ( string . IsNullOrEmpty ( _filter ) )
15111486 return changes ;
15121487
15131488 var visible = new List < Models . Change > ( ) ;
15141489
15151490 foreach ( var c in changes )
15161491 {
1517- if ( c . Path . Contains ( filter , StringComparison . OrdinalIgnoreCase ) )
1492+ if ( c . Path . Contains ( _filter , StringComparison . OrdinalIgnoreCase ) )
15181493 visible . Add ( c ) ;
15191494 }
15201495
@@ -1675,18 +1650,25 @@ private void SetDetail(Models.Change change, bool isUnstaged)
16751650 DetailContext = new DiffContext ( _repo . FullPath , new Models . DiffOption ( change , isUnstaged ) , _detailContext as DiffContext ) ;
16761651 }
16771652
1678- private void DoCommit ( bool autoStage , bool autoPush , bool allowEmpty )
1653+ private void DoCommit ( bool autoStage , bool autoPush , bool allowEmpty = false , bool confirmWithFilter = false )
16791654 {
16801655 if ( ! _repo . CanCreatePopup ( ) )
16811656 {
16821657 App . RaiseException ( _repo . FullPath , "Repository has unfinished job! Please wait!" ) ;
16831658 return ;
16841659 }
16851660
1686- if ( ! string . IsNullOrEmpty ( _stagedFilter ) )
1661+ if ( ! string . IsNullOrEmpty ( _filter ) && _staged . Count > _visibleStaged . Count && ! confirmWithFilter )
16871662 {
1688- // FIXME - make this a proper warning message-box "Staged-area filter will not be applied to commit. Continue?" Yes/No
1689- App . RaiseException ( _repo . FullPath , "Committing with staged-area filter applied is NOT allowed!" ) ;
1663+ var confirmMessage = App . Text ( "WorkingCopy.ConfirmCommitWithFilter" , _staged . Count , _visibleStaged . Count , _staged . Count - _visibleStaged . Count ) ;
1664+ App . OpenDialog ( new Views . ConfirmCommit ( )
1665+ {
1666+ DataContext = new ConfirmCommit ( confirmMessage , ( ) =>
1667+ {
1668+ DoCommit ( autoStage , autoPush , allowEmpty , true ) ;
1669+ } )
1670+ } ) ;
1671+
16901672 return ;
16911673 }
16921674
@@ -1700,9 +1682,13 @@ private void DoCommit(bool autoStage, bool autoPush, bool allowEmpty)
17001682 {
17011683 if ( ( autoStage && _count == 0 ) || ( ! autoStage && _staged . Count == 0 ) )
17021684 {
1703- App . OpenDialog ( new Views . ConfirmCommitWithoutFiles ( )
1685+ var confirmMessage = App . Text ( "WorkingCopy.ConfirmCommitWithoutFiles" ) ;
1686+ App . OpenDialog ( new Views . ConfirmCommit ( )
17041687 {
1705- DataContext = new ConfirmCommitWithoutFiles ( this , autoPush )
1688+ DataContext = new ConfirmCommit ( confirmMessage , ( ) =>
1689+ {
1690+ DoCommit ( autoStage , autoPush , true , confirmWithFilter ) ;
1691+ } )
17061692 } ) ;
17071693
17081694 return ;
@@ -1774,8 +1760,7 @@ private bool IsChanged(List<Models.Change> old, List<Models.Change> cur)
17741760 private List < Models . Change > _selectedStaged = [ ] ;
17751761 private int _count = 0 ;
17761762 private object _detailContext = null ;
1777- private string _unstagedFilter = string . Empty ;
1778- private string _stagedFilter = string . Empty ;
1763+ private string _filter = string . Empty ;
17791764 private string _commitMessage = string . Empty ;
17801765
17811766 private bool _hasUnsolvedConflicts = false ;
0 commit comments