@@ -50,6 +50,7 @@ public void Initialize(IRepositoryManager initRepositoryManager)
50
50
repositoryManager . CurrentBranchUpdated += RepositoryManagerOnCurrentBranchUpdated ;
51
51
repositoryManager . GitStatusUpdated += RepositoryManagerOnGitStatusUpdated ;
52
52
repositoryManager . GitLogUpdated += RepositoryManagerOnGitLogUpdated ;
53
+ repositoryManager . GitLocksUpdated += RepositoryManagerOnGitLocksUpdated ;
53
54
repositoryManager . LocalBranchesUpdated += RepositoryManagerOnLocalBranchesUpdated ;
54
55
repositoryManager . RemoteBranchesUpdated += RepositoryManagerOnRemoteBranchesUpdated ;
55
56
}
@@ -267,7 +268,7 @@ private void CacheContainer_OnCacheInvalidated(CacheType cacheType)
267
268
break ;
268
269
269
270
case CacheType . GitLocksCache :
270
- repositoryManager ? . UpdateLocks ( ) ;
271
+ UpdateLocks ( ) ;
271
272
break ;
272
273
273
274
case CacheType . GitUserCache :
@@ -353,18 +354,18 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
353
354
new ActionTask ( CancellationToken . None , ( ) => {
354
355
if ( ! Nullable . Equals ( CurrentConfigBranch , branch ) )
355
356
{
356
- var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
357
+ var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
357
358
358
- CurrentConfigBranch = branch ;
359
- CurrentBranch = currentBranch ;
360
- UpdateLocalBranches ( ) ;
359
+ CurrentConfigBranch = branch ;
360
+ CurrentBranch = currentBranch ;
361
+ UpdateLocalBranches ( ) ;
361
362
}
362
363
363
364
if ( ! Nullable . Equals ( CurrentConfigRemote , remote ) )
364
365
{
365
- CurrentConfigRemote = remote ;
366
- CurrentRemote = GetGitRemote ( remote . Value ) ;
367
- ClearRepositoryInfo ( ) ;
366
+ CurrentConfigRemote = remote ;
367
+ CurrentRemote = remote . HasValue ? ( GitRemote ? ) GetGitRemote ( remote . Value ) : null ;
368
+ ClearRepositoryInfo ( ) ;
368
369
}
369
370
} ) { Affinity = TaskAffinity . UI } . Start ( ) ;
370
371
}
@@ -383,6 +384,14 @@ private void RepositoryManagerOnGitLogUpdated(List<GitLogEntry> gitLogEntries)
383
384
} ) { Affinity = TaskAffinity . UI } . Start ( ) ;
384
385
}
385
386
387
+ private void RepositoryManagerOnGitLocksUpdated ( List < GitLock > gitLocks )
388
+ {
389
+ new ActionTask ( CancellationToken . None , ( ) => {
390
+ CurrentLocks = gitLocks ;
391
+ } )
392
+ { Affinity = TaskAffinity . UI } . Start ( ) ;
393
+ }
394
+
386
395
private void RepositoryManagerOnRemoteBranchesUpdated ( Dictionary < string , ConfigRemote > remotes ,
387
396
Dictionary < string , Dictionary < string , ConfigBranch > > branches )
388
397
{
@@ -401,6 +410,14 @@ private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBr
401
410
} ) { Affinity = TaskAffinity . UI } . Start ( ) ;
402
411
}
403
412
413
+ private void UpdateLocks ( )
414
+ {
415
+ if ( CurrentRemote . HasValue )
416
+ {
417
+ repositoryManager ? . UpdateLocks ( ) ;
418
+ }
419
+ }
420
+
404
421
private void UpdateLocalBranches ( )
405
422
{
406
423
LocalBranches = LocalConfigBranches . Values . Select ( GetLocalGitBranch ) . ToArray ( ) ;
0 commit comments