@@ -67,7 +67,6 @@ class SettingsView : Subview
6767 private const string DefaultRepositoryRemoteName = "origin" ;
6868
6969 [ NonSerialized ] private int newGitIgnoreRulesSelection = - 1 ;
70- [ NonSerialized ] private ConfigRemote ? activeRemote ;
7170
7271 [ SerializeField ] private string gitName ;
7372 [ SerializeField ] private string gitEmail ;
@@ -94,6 +93,8 @@ public override void OnEnable()
9493 {
9594 base . OnEnable ( ) ;
9695 AttachHandlers ( Repository ) ;
96+
97+ remoteHasChanged = true ;
9798 }
9899
99100 public override void OnDisable ( )
@@ -114,8 +115,9 @@ public override void OnRepositoryChanged(IRepository oldRepository)
114115
115116 DetachHandlers ( oldRepository ) ;
116117 AttachHandlers ( Repository ) ;
117- activeRemote = Repository . CurrentRemote ;
118+
118119 remoteHasChanged = true ;
120+
119121 Refresh ( ) ;
120122 }
121123
@@ -178,7 +180,7 @@ private void MaybeUpdateData()
178180
179181 if ( Repository == null )
180182 {
181- if ( cachedUser == null || String . IsNullOrEmpty ( cachedUser . Name ) )
183+ if ( ( cachedUser == null || String . IsNullOrEmpty ( cachedUser . Name ) ) && GitClient != null )
182184 {
183185 var user = new User ( ) ;
184186 GitClient . GetConfig ( "user.name" , GitConfigSource . User )
@@ -221,6 +223,7 @@ private void MaybeUpdateData()
221223 if ( remoteHasChanged )
222224 {
223225 remoteHasChanged = false ;
226+ var activeRemote = Repository . CurrentRemote ;
224227 hasRemote = activeRemote . HasValue && ! String . IsNullOrEmpty ( activeRemote . Value . Url ) ;
225228 if ( ! hasRemote )
226229 {
@@ -245,7 +248,6 @@ private void ResetToDefaults()
245248
246249 private void Repository_OnActiveRemoteChanged ( string remote )
247250 {
248- activeRemote = Repository . CurrentRemote ;
249251 remoteHasChanged = true ;
250252 }
251253
0 commit comments