@@ -586,6 +586,7 @@ private ContextMenu CreateContextMenuForLocalBranch(ViewModels.Repository repo,
586586 {
587587 var current = repo . CurrentBranch ;
588588 var menu = new ContextMenu ( ) ;
589+ var upstream = repo . Branches . Find ( x => x . FullName . Equals ( branch . Upstream , StringComparison . Ordinal ) ) ;
589590
590591 var push = new MenuItem ( ) ;
591592 push . Header = App . Text ( "BranchCM.Push" , branch . Name ) ;
@@ -602,27 +603,21 @@ private ContextMenu CreateContextMenuForLocalBranch(ViewModels.Repository repo,
602603 {
603604 if ( ! repo . IsBare )
604605 {
605- if ( ! string . IsNullOrEmpty ( branch . Upstream ) )
606+ if ( upstream != null )
606607 {
607- var upstream = branch . Upstream . Substring ( 13 ) ;
608608 var fastForward = new MenuItem ( ) ;
609- fastForward . Header = App . Text ( "BranchCM.FastForward" , upstream ) ;
609+ fastForward . Header = App . Text ( "BranchCM.FastForward" , upstream . FriendlyName ) ;
610610 fastForward . Icon = App . CreateMenuIcon ( "Icons.FastForward" ) ;
611- fastForward . IsEnabled = branch . TrackStatus . Ahead . Count == 0 ;
611+ fastForward . IsEnabled = branch . TrackStatus . Ahead . Count == 0 && branch . TrackStatus . Behind . Count > 0 ;
612612 fastForward . Click += ( _ , e ) =>
613613 {
614- var b = repo . Branches . Find ( x => x . FriendlyName == upstream ) ;
615- if ( b == null )
616- return ;
617-
618614 if ( repo . CanCreatePopup ( ) )
619- repo . ShowAndStartPopup ( new ViewModels . Merge ( repo , b , branch . Name , true ) ) ;
620-
615+ repo . ShowAndStartPopup ( new ViewModels . Merge ( repo , upstream , branch . Name , true ) ) ;
621616 e . Handled = true ;
622617 } ;
623618
624619 var pull = new MenuItem ( ) ;
625- pull . Header = App . Text ( "BranchCM.Pull" , upstream ) ;
620+ pull . Header = App . Text ( "BranchCM.Pull" , upstream . FriendlyName ) ;
626621 pull . Icon = App . CreateMenuIcon ( "Icons.Pull" ) ;
627622 pull . Click += ( _ , e ) =>
628623 {
@@ -656,13 +651,12 @@ private ContextMenu CreateContextMenuForLocalBranch(ViewModels.Repository repo,
656651 }
657652
658653 var worktree = repo . Worktrees . Find ( x => x . Branch == branch . FullName ) ;
659- var upstream = repo . Branches . Find ( x => x . FullName == branch . Upstream ) ;
660654 if ( upstream != null && worktree == null )
661655 {
662656 var fastForward = new MenuItem ( ) ;
663657 fastForward . Header = App . Text ( "BranchCM.FastForward" , upstream . FriendlyName ) ;
664658 fastForward . Icon = App . CreateMenuIcon ( "Icons.FastForward" ) ;
665- fastForward . IsEnabled = branch . TrackStatus . Ahead . Count == 0 ;
659+ fastForward . IsEnabled = branch . TrackStatus . Ahead . Count == 0 && branch . TrackStatus . Behind . Count > 0 ;
666660 fastForward . Click += ( _ , e ) =>
667661 {
668662 if ( repo . CanCreatePopup ( ) )
0 commit comments