@@ -419,6 +419,13 @@ - (void)performPushForBranch:(PBGitRef *)branchRef toRemote:(PBGitRef *)remoteRe
419
419
if (!types || [types indexOfObject: [refish refishType ]] != NSNotFound )
420
420
return refish;
421
421
}
422
+ NSString *remoteName = nil ;
423
+ if ([(remoteName = [(NSMenuItem *)sender representedObject ]) isKindOfClass: [NSString class ]]) {
424
+ if ([types indexOfObject: kGitXRemoteType ] != NSNotFound
425
+ && [self .repository.remotes indexOfObject: remoteName] != NSNotFound ) {
426
+ return [PBGitRef refFromString: [kGitXRemoteRefPrefix stringByAppendingString: remoteName]];
427
+ }
428
+ }
422
429
423
430
return nil ;
424
431
}
@@ -578,7 +585,7 @@ - (IBAction)pullRebaseDefaultRemote:(id)sender
578
585
579
586
- (IBAction )pushUpdatesToRemote : (id )sender
580
587
{
581
- id <PBGitRefish> refish = [self refishForSender: sender refishTypes: @[kGitXBranchType ]];
588
+ id <PBGitRefish> refish = [self refishForSender: sender refishTypes: @[kGitXRemoteType ]];
582
589
if (!refish || ![refish isKindOfClass: [PBGitRef class ]])
583
590
return ;
584
591
@@ -600,12 +607,16 @@ - (IBAction)pushDefaultRemoteForRef:(id)sender
600
607
601
608
- (IBAction )pushToRemote : (id )sender
602
609
{
603
- id <PBGitRefish> refish = [self refishForSender: sender refishTypes: @[kGitXBranchType ]];
604
- if (!refish || ![refish isKindOfClass: [PBGitRef class ]])
610
+ NSMenuItem *remoteSubmenu = sender;
611
+ if (![remoteSubmenu isKindOfClass: [NSMenuItem class ]]) return ;
612
+
613
+ id <PBGitRefish> ref = [self refishForSender: remoteSubmenu.parentItem refishTypes: @[kGitXBranchType ]];
614
+ if (!ref || ![ref isKindOfClass: [PBGitRef class ]])
605
615
return ;
606
616
607
- PBGitRef *ref = (PBGitRef *)refish;
608
- PBGitRef *remoteRef = ref.remoteRef ;
617
+ id <PBGitRefish> remoteRef = [self refishForSender: sender refishTypes: @[kGitXRemoteType ]];
618
+ if (!remoteRef || ![remoteRef isKindOfClass: [PBGitRef class ]])
619
+ return ;
609
620
610
621
[self performPushForBranch: ref toRemote: remoteRef];
611
622
}
0 commit comments