diff --git a/Classes/Views/PBRefMenuItem.m b/Classes/Views/PBRefMenuItem.m index fed45abe4..f7a944554 100644 --- a/Classes/Views/PBRefMenuItem.m +++ b/Classes/Views/PBRefMenuItem.m @@ -47,8 +47,9 @@ + (NSArray *) defaultMenuItemsForRef:(PBGitRef *)ref inRepository:(PBGitReposito BOOL isDetachedHead = (isHead && [headRefName isEqualToString:@"HEAD"]); NSString *remoteName = [ref remoteName]; - if (!remoteName && [ref isBranch]) + if (!remoteName && [ref isBranch]) { remoteName = [[repo remoteRefForBranch:ref error:NULL] remoteName]; + } BOOL hasRemote = (remoteName ? YES : NO); BOOL isRemote = ([ref isRemote] && ![ref isRemoteBranch]); @@ -131,8 +132,12 @@ + (NSArray *) defaultMenuItemsForRef:(PBGitRef *)ref inRepository:(PBGitReposito // delete ref [items addObject:[PBRefMenuItem separatorItem]]; - NSString *deleteTitle = [NSString stringWithFormat:@"Delete %@…", targetRefName]; - [items addObject:[PBRefMenuItem itemWithTitle:deleteTitle action:@selector(showDeleteRefSheet:) enabled:!isDetachedHead]]; + { + NSString *deleteTitle = [NSString stringWithFormat:@"Delete %@…", targetRefName]; + BOOL deleteEnabled = !(isDetachedHead || [ref isRemote]); + PBRefMenuItem *deleteItem = [PBRefMenuItem itemWithTitle:deleteTitle action:@selector(showDeleteRefSheet:) enabled:deleteEnabled]; + [items addObject:deleteItem]; + } for (PBRefMenuItem *item in items) { [item setTarget:target];