@@ -50,6 +50,7 @@ public void Initialize(IRepositoryManager initRepositoryManager)
5050 repositoryManager . CurrentBranchUpdated += RepositoryManagerOnCurrentBranchUpdated ;
5151 repositoryManager . GitStatusUpdated += RepositoryManagerOnGitStatusUpdated ;
5252 repositoryManager . GitLogUpdated += RepositoryManagerOnGitLogUpdated ;
53+ repositoryManager . GitLocksUpdated += RepositoryManagerOnGitLocksUpdated ;
5354 repositoryManager . LocalBranchesUpdated += RepositoryManagerOnLocalBranchesUpdated ;
5455 repositoryManager . RemoteBranchesUpdated += RepositoryManagerOnRemoteBranchesUpdated ;
5556 }
@@ -267,7 +268,7 @@ private void CacheContainer_OnCacheInvalidated(CacheType cacheType)
267268 break ;
268269
269270 case CacheType . GitLocksCache :
270- repositoryManager ? . UpdateLocks ( ) ;
271+ UpdateLocks ( ) ;
271272 break ;
272273
273274 case CacheType . GitUserCache :
@@ -353,18 +354,18 @@ private void RepositoryManagerOnCurrentBranchUpdated(ConfigBranch? branch, Confi
353354 new ActionTask ( CancellationToken . None , ( ) => {
354355 if ( ! Nullable . Equals ( CurrentConfigBranch , branch ) )
355356 {
356- var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
357+ var currentBranch = branch != null ? ( GitBranch ? ) GetLocalGitBranch ( branch . Value ) : null ;
357358
358- CurrentConfigBranch = branch ;
359- CurrentBranch = currentBranch ;
360- UpdateLocalBranches ( ) ;
359+ CurrentConfigBranch = branch ;
360+ CurrentBranch = currentBranch ;
361+ UpdateLocalBranches ( ) ;
361362 }
362363
363364 if ( ! Nullable . Equals ( CurrentConfigRemote , remote ) )
364365 {
365- CurrentConfigRemote = remote ;
366- CurrentRemote = GetGitRemote ( remote . Value ) ;
367- ClearRepositoryInfo ( ) ;
366+ CurrentConfigRemote = remote ;
367+ CurrentRemote = remote . HasValue ? ( GitRemote ? ) GetGitRemote ( remote . Value ) : null ;
368+ ClearRepositoryInfo ( ) ;
368369 }
369370 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
370371 }
@@ -383,6 +384,14 @@ private void RepositoryManagerOnGitLogUpdated(List<GitLogEntry> gitLogEntries)
383384 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
384385 }
385386
387+ private void RepositoryManagerOnGitLocksUpdated ( List < GitLock > gitLocks )
388+ {
389+ new ActionTask ( CancellationToken . None , ( ) => {
390+ CurrentLocks = gitLocks ;
391+ } )
392+ { Affinity = TaskAffinity . UI } . Start ( ) ;
393+ }
394+
386395 private void RepositoryManagerOnRemoteBranchesUpdated ( Dictionary < string , ConfigRemote > remotes ,
387396 Dictionary < string , Dictionary < string , ConfigBranch > > branches )
388397 {
@@ -401,6 +410,14 @@ private void RepositoryManagerOnLocalBranchesUpdated(Dictionary<string, ConfigBr
401410 } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
402411 }
403412
413+ private void UpdateLocks ( )
414+ {
415+ if ( CurrentRemote . HasValue )
416+ {
417+ repositoryManager ? . UpdateLocks ( ) ;
418+ }
419+ }
420+
404421 private void UpdateLocalBranches ( )
405422 {
406423 LocalBranches = LocalConfigBranches . Values . Select ( GetLocalGitBranch ) . ToArray ( ) ;
0 commit comments