@@ -586,6 +586,7 @@ private ContextMenu CreateContextMenuForLocalBranch(ViewModels.Repository repo,
586
586
{
587
587
var current = repo . CurrentBranch ;
588
588
var menu = new ContextMenu ( ) ;
589
+ var upstream = repo . Branches . Find ( x => x . FullName . Equals ( branch . Upstream , StringComparison . Ordinal ) ) ;
589
590
590
591
var push = new MenuItem ( ) ;
591
592
push . Header = App . Text ( "BranchCM.Push" , branch . Name ) ;
@@ -602,27 +603,21 @@ private ContextMenu CreateContextMenuForLocalBranch(ViewModels.Repository repo,
602
603
{
603
604
if ( ! repo . IsBare )
604
605
{
605
- if ( ! string . IsNullOrEmpty ( branch . Upstream ) )
606
+ if ( upstream != null )
606
607
{
607
- var upstream = branch . Upstream . Substring ( 13 ) ;
608
608
var fastForward = new MenuItem ( ) ;
609
- fastForward . Header = App . Text ( "BranchCM.FastForward" , upstream ) ;
609
+ fastForward . Header = App . Text ( "BranchCM.FastForward" , upstream . FriendlyName ) ;
610
610
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 ;
612
612
fastForward . Click += ( _ , e ) =>
613
613
{
614
- var b = repo . Branches . Find ( x => x . FriendlyName == upstream ) ;
615
- if ( b == null )
616
- return ;
617
-
618
614
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 ) ) ;
621
616
e . Handled = true ;
622
617
} ;
623
618
624
619
var pull = new MenuItem ( ) ;
625
- pull . Header = App . Text ( "BranchCM.Pull" , upstream ) ;
620
+ pull . Header = App . Text ( "BranchCM.Pull" , upstream . FriendlyName ) ;
626
621
pull . Icon = App . CreateMenuIcon ( "Icons.Pull" ) ;
627
622
pull . Click += ( _ , e ) =>
628
623
{
@@ -656,13 +651,12 @@ private ContextMenu CreateContextMenuForLocalBranch(ViewModels.Repository repo,
656
651
}
657
652
658
653
var worktree = repo . Worktrees . Find ( x => x . Branch == branch . FullName ) ;
659
- var upstream = repo . Branches . Find ( x => x . FullName == branch . Upstream ) ;
660
654
if ( upstream != null && worktree == null )
661
655
{
662
656
var fastForward = new MenuItem ( ) ;
663
657
fastForward . Header = App . Text ( "BranchCM.FastForward" , upstream . FriendlyName ) ;
664
658
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 ;
666
660
fastForward . Click += ( _ , e ) =>
667
661
{
668
662
if ( repo . CanCreatePopup ( ) )
0 commit comments