@@ -51,6 +51,7 @@ public void Initialize(IRepositoryManager initRepositoryManager)
51
51
repositoryManager . GitStatusUpdated += RepositoryManagerOnGitStatusUpdated ;
52
52
repositoryManager . GitAheadBehindStatusUpdated += RepositoryManagerOnGitAheadBehindStatusUpdated ;
53
53
repositoryManager . GitLogUpdated += RepositoryManagerOnGitLogUpdated ;
54
+ repositoryManager . GitLocksUpdated += RepositoryManagerOnGitLocksUpdated ;
54
55
repositoryManager . LocalBranchesUpdated += RepositoryManagerOnLocalBranchesUpdated ;
55
56
repositoryManager . RemoteBranchesUpdated += RepositoryManagerOnRemoteBranchesUpdated ;
56
57
}
@@ -268,7 +269,7 @@ private void CacheContainer_OnCacheInvalidated(CacheType cacheType)
268
269
break ;
269
270
270
271
case CacheType . GitLocksCache :
271
- repositoryManager ? . UpdateLocks ( ) ;
272
+ UpdateLocks ( ) ;
272
273
break ;
273
274
274
275
case CacheType . GitUserCache :
@@ -354,18 +355,18 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
354
355
new ActionTask ( CancellationToken . None , ( ) => {
355
356
if ( ! Nullable . Equals ( CurrentConfigBranch , branch ) )
356
357
{
357
- var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
358
+ var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
358
359
359
- CurrentConfigBranch = branch ;
360
- CurrentBranch = currentBranch ;
361
- UpdateLocalBranches ( ) ;
360
+ CurrentConfigBranch = branch ;
361
+ CurrentBranch = currentBranch ;
362
+ UpdateLocalBranches ( ) ;
362
363
}
363
364
364
365
if ( ! Nullable . Equals ( CurrentConfigRemote , remote ) )
365
366
{
366
- CurrentConfigRemote = remote ;
367
- CurrentRemote = GetGitRemote ( remote . Value ) ;
368
- ClearRepositoryInfo ( ) ;
367
+ CurrentConfigRemote = remote ;
368
+ CurrentRemote = remote . HasValue ? ( GitRemote ? ) GetGitRemote ( remote . Value ) : null ;
369
+ ClearRepositoryInfo ( ) ;
369
370
}
370
371
} ) { Affinity = TaskAffinity . UI } . Start ( ) ;
371
372
}
@@ -395,6 +396,14 @@ private void RepositoryManagerOnGitLogUpdated(List<GitLogEntry> gitLogEntries)
395
396
} ) { Affinity = TaskAffinity . UI } . Start ( ) ;
396
397
}
397
398
399
+ private void RepositoryManagerOnGitLocksUpdated ( List < GitLock > gitLocks )
400
+ {
401
+ new ActionTask ( CancellationToken . None , ( ) => {
402
+ CurrentLocks = gitLocks ;
403
+ } )
404
+ { Affinity = TaskAffinity . UI } . Start ( ) ;
405
+ }
406
+
398
407
private void RepositoryManagerOnRemoteBranchesUpdated ( Dictionary < string , ConfigRemote > remotes ,
399
408
Dictionary < string , Dictionary < string , ConfigBranch > > branches )
400
409
{
@@ -419,6 +428,14 @@ private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBr
419
428
} ) { Affinity = TaskAffinity . UI } . Start ( ) ;
420
429
}
421
430
431
+ private void UpdateLocks ( )
432
+ {
433
+ if ( CurrentRemote . HasValue )
434
+ {
435
+ repositoryManager ? . UpdateLocks ( ) ;
436
+ }
437
+ }
438
+
422
439
private void UpdateLocalBranches ( )
423
440
{
424
441
LocalBranches = LocalConfigBranches . Values . Select ( GetLocalGitBranch ) . ToArray ( ) ;
0 commit comments