@@ -109,19 +109,7 @@ public override void OnDataUpdate()
109109 {
110110 base . OnDataUpdate ( ) ;
111111
112- string repoRemote = null ;
113- if ( MaybeUpdateData ( out repoRemote ) )
114- {
115- repoBranchContent = new GUIContent ( repoBranch , Window_RepoBranchTooltip ) ;
116- if ( repoUrl != null )
117- {
118- repoUrlContent = new GUIContent ( repoUrl , string . Format ( Window_RepoUrlTooltip , repoRemote ) ) ;
119- }
120- else
121- {
122- repoUrlContent = new GUIContent ( repoUrl , Window_RepoNoUrlTooltip ) ;
123- }
124- }
112+ MaybeUpdateData ( ) ;
125113
126114 if ( ActiveView != null )
127115 ActiveView . OnDataUpdate ( ) ;
@@ -198,45 +186,43 @@ private void RefreshOnMainThread()
198186 new ActionTask ( TaskManager . Token , Refresh ) { Affinity = TaskAffinity . UI } . Start ( ) ;
199187 }
200188
201- private bool MaybeUpdateData ( out string repoRemote )
189+ private void MaybeUpdateData ( )
202190 {
203- repoRemote = null ;
204- bool repoDataChanged = false ;
191+ string updatedRepoBranch = null ;
192+ string updatedRepoRemote = null ;
193+ string updatedRepoUrl = DefaultRepoUrl ;
194+
205195 if ( Repository != null )
206196 {
207- var currentBranchString = ( Repository . CurrentBranch . HasValue ? Repository . CurrentBranch . Value . Name : null ) ;
208- if ( repoBranch != currentBranchString )
209- {
210- repoBranch = currentBranchString ;
211- repoDataChanged = true ;
212- }
197+ var repositoryCurrentBranch = Repository . CurrentBranch ;
198+ updatedRepoBranch = repositoryCurrentBranch . HasValue ? repositoryCurrentBranch . Value . Name : null ;
213199
214- var url = Repository . CloneUrl != null ? Repository . CloneUrl . ToString ( ) : DefaultRepoUrl ;
215- if ( repoUrl != url )
216- {
217- repoUrl = url ;
218- repoDataChanged = true ;
219- }
200+ var repositoryCloneUrl = Repository . CloneUrl ;
201+ updatedRepoUrl = repositoryCloneUrl != null ? repositoryCloneUrl . ToString ( ) : DefaultRepoUrl ;
220202
221- if ( Repository . CurrentRemote . HasValue )
222- repoRemote = Repository . CurrentRemote . Value . Name ;
203+ var repositoryCurrentRemote = Repository . CurrentRemote ;
204+ if ( repositoryCurrentRemote . HasValue )
205+ updatedRepoRemote = repositoryCurrentRemote . Value . Name ;
223206 }
224- else
207+
208+ if ( repoBranch != updatedRepoBranch )
209+ {
210+ repoBranch = updatedRepoBranch ;
211+ repoBranchContent = new GUIContent ( repoBranch , Window_RepoBranchTooltip ) ;
212+ }
213+
214+ if ( repoUrl != updatedRepoUrl )
225215 {
226- if ( repoBranch != null )
216+ repoUrl = updatedRepoUrl ;
217+ if ( updatedRepoRemote != null )
227218 {
228- repoBranch = null ;
229- repoDataChanged = true ;
219+ repoUrlContent = new GUIContent ( repoUrl , string . Format ( Window_RepoUrlTooltip , updatedRepoRemote ) ) ;
230220 }
231-
232- if ( repoUrl != DefaultRepoUrl )
221+ else
233222 {
234- repoUrl = DefaultRepoUrl ;
235- repoDataChanged = true ;
223+ repoUrlContent = new GUIContent ( repoUrl , Window_RepoNoUrlTooltip ) ;
236224 }
237225 }
238-
239- return repoDataChanged ;
240226 }
241227
242228 private void AttachHandlers ( IRepository repository )
0 commit comments