@@ -109,19 +109,7 @@ public override void OnDataUpdate()
109
109
{
110
110
base . OnDataUpdate ( ) ;
111
111
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 ( ) ;
125
113
126
114
if ( ActiveView != null )
127
115
ActiveView . OnDataUpdate ( ) ;
@@ -198,45 +186,43 @@ private void RefreshOnMainThread()
198
186
new ActionTask ( TaskManager . Token , Refresh ) { Affinity = TaskAffinity . UI } . Start ( ) ;
199
187
}
200
188
201
- private bool MaybeUpdateData ( out string repoRemote )
189
+ private void MaybeUpdateData ( )
202
190
{
203
- repoRemote = null ;
204
- bool repoDataChanged = false ;
191
+ string updatedRepoBranch = null ;
192
+ string updatedRepoRemote = null ;
193
+ string updatedRepoUrl = DefaultRepoUrl ;
194
+
205
195
if ( Repository != null )
206
196
{
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 ;
213
199
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 ;
220
202
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 ;
223
206
}
224
- else
207
+
208
+ if ( repoBranch != updatedRepoBranch )
209
+ {
210
+ repoBranch = updatedRepoBranch ;
211
+ repoBranchContent = new GUIContent ( repoBranch , Window_RepoBranchTooltip ) ;
212
+ }
213
+
214
+ if ( repoUrl != updatedRepoUrl )
225
215
{
226
- if ( repoBranch != null )
216
+ repoUrl = updatedRepoUrl ;
217
+ if ( updatedRepoRemote != null )
227
218
{
228
- repoBranch = null ;
229
- repoDataChanged = true ;
219
+ repoUrlContent = new GUIContent ( repoUrl , string . Format ( Window_RepoUrlTooltip , updatedRepoRemote ) ) ;
230
220
}
231
-
232
- if ( repoUrl != DefaultRepoUrl )
221
+ else
233
222
{
234
- repoUrl = DefaultRepoUrl ;
235
- repoDataChanged = true ;
223
+ repoUrlContent = new GUIContent ( repoUrl , Window_RepoNoUrlTooltip ) ;
236
224
}
237
225
}
238
-
239
- return repoDataChanged ;
240
226
}
241
227
242
228
private void AttachHandlers ( IRepository repository )
0 commit comments