@@ -40,6 +40,7 @@ class Window : BaseWindow
4040 [ SerializeField ] private int statusAhead ;
4141 [ SerializeField ] private int statusBehind ;
4242 [ SerializeField ] private bool hasItemsToCommit ;
43+ [ SerializeField ] private bool isTrackingRemoteBranch ;
4344 [ SerializeField ] private GUIContent currentBranchContent ;
4445 [ SerializeField ] private GUIContent currentRemoteUrlContent ;
4546 [ SerializeField ] private CacheUpdateEvent lastCurrentBranchAndRemoteChangedEvent ;
@@ -279,7 +280,17 @@ private void MaybeUpdateData()
279280 currentBranchAndRemoteHasUpdate = false ;
280281
281282 var repositoryCurrentBranch = Repository . CurrentBranch ;
282- var updatedRepoBranch = repositoryCurrentBranch . HasValue ? repositoryCurrentBranch . Value . Name : null ;
283+ string updatedRepoBranch ;
284+ if ( repositoryCurrentBranch . HasValue )
285+ {
286+ updatedRepoBranch = repositoryCurrentBranch . Value . Name ;
287+ isTrackingRemoteBranch = ! string . IsNullOrEmpty ( repositoryCurrentBranch . Value . Tracking ) ;
288+ }
289+ else
290+ {
291+ updatedRepoBranch = null ;
292+ isTrackingRemoteBranch = false ;
293+ }
283294
284295 var repositoryCurrentRemote = Repository . CurrentRemote ;
285296 if ( repositoryCurrentRemote . HasValue )
@@ -313,6 +324,8 @@ private void MaybeUpdateData()
313324 }
314325 else
315326 {
327+ isTrackingRemoteBranch = false ;
328+
316329 if ( currentRemoteName != null )
317330 {
318331 currentRemoteName = null ;
@@ -591,7 +604,7 @@ private void DoActionbarGUI()
591604 EditorGUI . EndDisabledGroup ( ) ;
592605
593606 // Push button
594- EditorGUI . BeginDisabledGroup ( currentRemoteName == null || statusAhead == 0 ) ;
607+ EditorGUI . BeginDisabledGroup ( currentRemoteName == null || isTrackingRemoteBranch && statusAhead == 0 ) ;
595608 {
596609 var pushButtonText = statusAhead > 0 ? new GUIContent ( String . Format ( Localization . PushButtonCount , statusAhead ) ) : pushButtonContent ;
597610 var pushClicked = GUILayout . Button ( pushButtonText , Styles . ToolbarButtonStyle ) ;
0 commit comments