@@ -92,9 +92,10 @@ - (BOOL) validateMenuItem:(NSMenuItem *)menuItem remoteTitle:(NSString *)localis
92
92
if (!ref && (item.parent == sidebarController.remotes )) {
93
93
ref = [PBGitRef refFromString: [kGitXRemoteRefPrefix stringByAppendingString: item.title]];
94
94
}
95
-
96
- if (ref.isRemote ) {
97
- menuItem.title = [NSString stringWithFormat: NSLocalizedString(localisationKeyWithRemote, @" " ), ref.remoteName];
95
+
96
+ PBGitRef *remoteRef = [self .repository remoteRefForBranch: ref error: NULL ];
97
+ if (ref.isRemote || remoteRef) {
98
+ menuItem.title = [NSString stringWithFormat: NSLocalizedString(localisationKeyWithRemote, @" " ), (!remoteRef ? ref.remoteName : remoteRef.remoteName)];
98
99
menuItem.representedObject = ref;
99
100
return YES ;
100
101
}
@@ -269,11 +270,17 @@ - (void)revealURLsInFinder:(NSArray <NSURL *> *)fileURLs
269
270
270
271
- (void )performFetchForRef : (PBGitRef *)ref
271
272
{
272
- NSString *remoteName = (ref ? ref.remoteName : @" all remotes" );
273
- NSString *description = [NSString stringWithFormat: @" Fetching tracking branches for %@ " , remoteName];
273
+ NSString *desc = nil ;
274
+ if (ref == nil ) {
275
+ desc = [NSString stringWithFormat: @" Fetching all remotes" ];
276
+ } else if (ref.isRemote || ref.isRemoteBranch ) {
277
+ desc = [NSString stringWithFormat: @" Fetching branches from remote %@ " , ref.remoteName];
278
+ } else {
279
+ desc = [NSString stringWithFormat: @" Fetching tracking branch for %@ " , ref.shortName];
280
+ }
274
281
275
282
PBRemoteProgressSheet *progressSheet = [PBRemoteProgressSheet progressSheetWithTitle: @" Fetching remote…"
276
- description: description
283
+ description: desc
277
284
windowController: self ];
278
285
279
286
[progressSheet beginProgressSheetForBlock: ^{
@@ -458,10 +465,13 @@ - (IBAction)addRemote:(id)sender
458
465
}];
459
466
}
460
467
461
- - (IBAction ) fetchRemote : (id )sender {
462
- /* FIXME: this is wrong, you can right-click in the sidebar but try to fetch the *selected* ref */
463
- PBGitRef *ref = [self selectedItem ].ref ;
464
- [self performFetchForRef: ref];
468
+ - (IBAction )fetchRemote : (id )sender
469
+ {
470
+ id <PBGitRefish> refish = [self refishForSender: sender refishTypes: @[kGitXBranchType , kGitXRemoteType ]];
471
+ if (!refish || ![refish isKindOfClass: [PBGitRef class ]])
472
+ return ;
473
+
474
+ [self performFetchForRef: refish];
465
475
}
466
476
467
477
- (IBAction ) fetchAllRemotes : (id )sender {
0 commit comments