File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change 11using System . Collections . Generic ;
22using System . Diagnostics ;
3+ using System . Text ;
34using System . Text . RegularExpressions ;
45using System . Threading . Tasks ;
56
@@ -9,13 +10,21 @@ public partial class QueryLocalChanges : Command
910 {
1011 [ GeneratedRegex ( @"^(\s?[\w\?]{1,4})\s+(.+)$" ) ]
1112 private static partial Regex REG_FORMAT ( ) ;
12- private static readonly string [ ] UNTRACKED = [ "no" , "all" ] ;
1313
14- public QueryLocalChanges ( string repo , bool includeUntracked = true )
14+ public QueryLocalChanges ( string repo , bool includeUntracked = true , bool noOptionalLocks = true )
1515 {
1616 WorkingDirectory = repo ;
1717 Context = repo ;
18- Args = $ "--no-optional-locks status -u{ UNTRACKED [ includeUntracked ? 1 : 0 ] } --ignore-submodules=dirty --porcelain";
18+
19+ var builder = new StringBuilder ( ) ;
20+ if ( noOptionalLocks )
21+ builder . Append ( "--no-optional-locks " ) ;
22+ if ( includeUntracked )
23+ builder . Append ( "-c core.untrackedCache=true -c status.showUntrackedFiles=all status -uall --ignore-submodules=dirty --porcelain" ) ;
24+ else
25+ builder . Append ( "status -uno --ignore-submodules=dirty --porcelain" ) ;
26+
27+ Args = builder . ToString ( ) ;
1928 }
2029
2130 public async Task < List < Models . Change > > GetResultAsync ( )
Original file line number Diff line number Diff line change @@ -1305,10 +1305,11 @@ public void RefreshWorkingCopyChanges()
13051305
13061306 _cancellationRefreshWorkingCopyChanges = new CancellationTokenSource ( ) ;
13071307 var token = _cancellationRefreshWorkingCopyChanges . Token ;
1308+ var noOptionalLocks = Interlocked . Add ( ref _queryLocalChangesTimes , 1 ) > 1 ;
13081309
13091310 Task . Run ( async ( ) =>
13101311 {
1311- var changes = await new Commands . QueryLocalChanges ( FullPath , _settings . IncludeUntrackedInLocalChanges )
1312+ var changes = await new Commands . QueryLocalChanges ( FullPath , _settings . IncludeUntrackedInLocalChanges , noOptionalLocks )
13121313 . GetResultAsync ( )
13131314 . ConfigureAwait ( false ) ;
13141315
@@ -1901,6 +1902,7 @@ private async Task AutoFetchOnUIThread()
19011902 private Models . HistoryFilterCollection _historyFilterCollection = null ;
19021903 private Models . FilterMode _historyFilterMode = Models . FilterMode . None ;
19031904 private bool _hasAllowedSignersFile = false ;
1905+ private ulong _queryLocalChangesTimes = 0 ;
19041906
19051907 private Models . Watcher _watcher = null ;
19061908 private Histories _histories = null ;
You can’t perform that action at this time.
0 commit comments