Skip to content

Commit 40c88c8

Browse files
committed
Rewire tag info action
1 parent 2e63424 commit 40c88c8

File tree

2 files changed

+26
-28
lines changed

2 files changed

+26
-28
lines changed

Classes/Controllers/PBGitHistoryController.m

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -876,6 +876,32 @@ - (IBAction)stashViewDiff:(id)sender
876876
[PBDiffWindowController showDiffWindowWithFiles:nil fromCommit:stash.ancestorCommit diffCommit:stash.commit];
877877
}
878878

879+
- (IBAction)showTagInfoSheet:(id)sender
880+
{
881+
id <PBGitRefish> refish = [self refishForSender:sender refishTypes:@[kGitXTagType]];
882+
if (!refish)
883+
return;
884+
885+
PBGitRef *ref = (PBGitRef *)refish;
886+
887+
NSError *error = nil;
888+
NSString *tagName = [ref tagName];
889+
NSString *tagRef = [@"refs/tags/" stringByAppendingString:tagName];
890+
GTObject *object = [self.repository.gtRepo lookUpObjectByRevParse:tagRef error:&error];
891+
if (!object) {
892+
NSLog(@"Couldn't look up ref %@:%@", tagRef, [error debugDescription]);
893+
return;
894+
}
895+
NSString *title = [NSString stringWithFormat:@"Info for tag: %@", tagName];
896+
NSString *info = @"";
897+
if ([object isKindOfClass:[GTTag class]]) {
898+
GTTag *tag = (GTTag*)object;
899+
info = tag.message;
900+
}
901+
902+
[self.windowController showMessageSheet:title infoText:info];
903+
}
904+
879905
#pragma mark -
880906
#pragma mark Quick Look
881907

Classes/Controllers/PBRefController.m

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,6 @@ - (void)awakeFromNib
2626
[commitList registerForDraggedTypes:[NSArray arrayWithObject:@"PBGitRef"]];
2727
}
2828

29-
#pragma mark Tags
30-
31-
- (IBAction) showTagInfoSheet:(PBRefMenuItem *)sender
32-
{
33-
id<PBGitRefish> refish = sender.refishs.firstObject;
34-
if ([refish refishType] != kGitXTagType)
35-
return;
36-
37-
PBGitRef *ref = (PBGitRef *)refish;
38-
39-
NSString *tagName = [ref tagName];
40-
NSString *tagRef = [@"refs/tags/" stringByAppendingString:tagName];
41-
NSError *error = nil;
42-
GTObject *object = [historyController.repository.gtRepo lookUpObjectByRevParse:tagRef error:&error];
43-
if (!object) {
44-
NSLog(@"Couldn't look up ref %@:%@", tagRef, [error debugDescription]);
45-
return;
46-
}
47-
NSString* title = [NSString stringWithFormat:@"Info for tag: %@", tagName];
48-
NSString* info = @"";
49-
if ([object isKindOfClass:[GTTag class]]) {
50-
GTTag *tag = (GTTag*)object;
51-
info = tag.message;
52-
}
53-
[historyController.windowController showMessageSheet:title infoText:info];
54-
}
55-
56-
5729
#pragma mark Contextual menus
5830

5931
- (NSArray<NSMenuItem *> *) menuItemsForRef:(PBGitRef *)ref

0 commit comments

Comments
 (0)