@@ -99,38 +99,23 @@ public bool UseAmend
99
99
}
100
100
}
101
101
102
- public string UnstagedFilter
102
+ public string Filter
103
103
{
104
- get => _unstagedFilter ;
104
+ get => _filter ;
105
105
set
106
106
{
107
- if ( SetProperty ( ref _unstagedFilter , value ) )
107
+ if ( SetProperty ( ref _filter , value ) )
108
108
{
109
109
if ( _isLoadingData )
110
110
return ;
111
111
112
- VisibleUnstaged = GetVisibleChanges ( _unstaged , _unstagedFilter ) ;
112
+ VisibleUnstaged = GetVisibleChanges ( _unstaged ) ;
113
+ VisibleStaged = GetVisibleChanges ( _staged ) ;
113
114
SelectedUnstaged = [ ] ;
114
115
}
115
116
}
116
117
}
117
118
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
-
134
119
public List < Models . Change > Unstaged
135
120
{
136
121
get => _unstaged ;
@@ -294,7 +279,7 @@ public void SetData(List<Models.Change> changes)
294
279
}
295
280
}
296
281
297
- var visibleUnstaged = GetVisibleChanges ( unstaged , _unstagedFilter ) ;
282
+ var visibleUnstaged = GetVisibleChanges ( unstaged ) ;
298
283
var selectedUnstaged = new List < Models . Change > ( ) ;
299
284
foreach ( var c in visibleUnstaged )
300
285
{
@@ -304,7 +289,7 @@ public void SetData(List<Models.Change> changes)
304
289
305
290
var staged = GetStagedChanges ( ) ;
306
291
307
- var visibleStaged = GetVisibleChanges ( staged , _stagedFilter ) ;
292
+ var visibleStaged = GetVisibleChanges ( staged ) ;
308
293
var selectedStaged = new List < Models . Change > ( ) ;
309
294
foreach ( var c in visibleStaged )
310
295
{
@@ -374,14 +359,9 @@ public void Discard(List<Models.Change> changes)
374
359
_repo . ShowPopup ( new Discard ( _repo , changes ) ) ;
375
360
}
376
361
377
- public void ClearUnstagedFilter ( )
378
- {
379
- UnstagedFilter = string . Empty ;
380
- }
381
-
382
- public void ClearStagedFilter ( )
362
+ public void ClearFilter ( )
383
363
{
384
- StagedFilter = string . Empty ;
364
+ Filter = string . Empty ;
385
365
}
386
366
387
367
public async void UseTheirs ( List < Models . Change > changes )
@@ -571,11 +551,6 @@ public void CommitWithPush()
571
551
DoCommit ( false , true , false ) ;
572
552
}
573
553
574
- public void CommitWithoutFiles ( bool autoPush )
575
- {
576
- DoCommit ( false , autoPush , true ) ;
577
- }
578
-
579
554
public ContextMenu CreateContextMenuForUnstagedChanges ( )
580
555
{
581
556
if ( _selectedUnstaged == null || _selectedUnstaged . Count == 0 )
@@ -1505,16 +1480,16 @@ public ContextMenu CreateContextForOpenAI()
1505
1480
return menu ;
1506
1481
}
1507
1482
1508
- private List < Models . Change > GetVisibleChanges ( List < Models . Change > changes , string filter )
1483
+ private List < Models . Change > GetVisibleChanges ( List < Models . Change > changes )
1509
1484
{
1510
- if ( string . IsNullOrEmpty ( filter ) )
1485
+ if ( string . IsNullOrEmpty ( _filter ) )
1511
1486
return changes ;
1512
1487
1513
1488
var visible = new List < Models . Change > ( ) ;
1514
1489
1515
1490
foreach ( var c in changes )
1516
1491
{
1517
- if ( c . Path . Contains ( filter , StringComparison . OrdinalIgnoreCase ) )
1492
+ if ( c . Path . Contains ( _filter , StringComparison . OrdinalIgnoreCase ) )
1518
1493
visible . Add ( c ) ;
1519
1494
}
1520
1495
@@ -1675,18 +1650,25 @@ private void SetDetail(Models.Change change, bool isUnstaged)
1675
1650
DetailContext = new DiffContext ( _repo . FullPath , new Models . DiffOption ( change , isUnstaged ) , _detailContext as DiffContext ) ;
1676
1651
}
1677
1652
1678
- private void DoCommit ( bool autoStage , bool autoPush , bool allowEmpty )
1653
+ private void DoCommit ( bool autoStage , bool autoPush , bool allowEmpty = false , bool confirmWithFilter = false )
1679
1654
{
1680
1655
if ( ! _repo . CanCreatePopup ( ) )
1681
1656
{
1682
1657
App . RaiseException ( _repo . FullPath , "Repository has unfinished job! Please wait!" ) ;
1683
1658
return ;
1684
1659
}
1685
1660
1686
- if ( ! string . IsNullOrEmpty ( _stagedFilter ) )
1661
+ if ( ! string . IsNullOrEmpty ( _filter ) && _staged . Count > _visibleStaged . Count && ! confirmWithFilter )
1687
1662
{
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
+
1690
1672
return ;
1691
1673
}
1692
1674
@@ -1700,9 +1682,13 @@ private void DoCommit(bool autoStage, bool autoPush, bool allowEmpty)
1700
1682
{
1701
1683
if ( ( autoStage && _count == 0 ) || ( ! autoStage && _staged . Count == 0 ) )
1702
1684
{
1703
- App . OpenDialog ( new Views . ConfirmCommitWithoutFiles ( )
1685
+ var confirmMessage = App . Text ( "WorkingCopy.ConfirmCommitWithoutFiles" ) ;
1686
+ App . OpenDialog ( new Views . ConfirmCommit ( )
1704
1687
{
1705
- DataContext = new ConfirmCommitWithoutFiles ( this , autoPush )
1688
+ DataContext = new ConfirmCommit ( confirmMessage , ( ) =>
1689
+ {
1690
+ DoCommit ( autoStage , autoPush , true , confirmWithFilter ) ;
1691
+ } )
1706
1692
} ) ;
1707
1693
1708
1694
return ;
@@ -1774,8 +1760,7 @@ private bool IsChanged(List<Models.Change> old, List<Models.Change> cur)
1774
1760
private List < Models . Change > _selectedStaged = [ ] ;
1775
1761
private int _count = 0 ;
1776
1762
private object _detailContext = null ;
1777
- private string _unstagedFilter = string . Empty ;
1778
- private string _stagedFilter = string . Empty ;
1763
+ private string _filter = string . Empty ;
1779
1764
private string _commitMessage = string . Empty ;
1780
1765
1781
1766
private bool _hasUnsolvedConflicts = false ;
0 commit comments