@@ -39,28 +39,29 @@ - (void) removeRefSheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode conte
39
39
if (returnCode == NSAlertDefaultReturn ) {
40
40
int ret = 1 ;
41
41
PBRefMenuItem *refMenuItem = contextInfo;
42
- [historyController.repository outputForArguments: [NSArray arrayWithObjects: @" update-ref" , @" -d" , [[refMenuItem ref ] ref ], nil ] retValue: &ret];
42
+ [historyController.repository outputForArguments: [NSArray arrayWithObjects: @" update-ref" , @" -d" , [[refMenuItem refish ] refishName ], nil ] retValue: &ret];
43
43
if (ret) {
44
44
NSLog (@" Removing ref failed!" );
45
45
return ;
46
46
}
47
- [historyController.repository removeBranch: [[PBGitRevSpecifier alloc ] initWithRef: [refMenuItem ref ]]];
48
- [[refMenuItem commit ] removeRef: [refMenuItem ref ]];
47
+ [historyController.repository removeBranch: [[PBGitRevSpecifier alloc ] initWithRef: [refMenuItem refish ]]];
48
+ PBGitCommit *commitForRef = [historyController.repository commitForRef: [refMenuItem refish ]];
49
+ [commitForRef removeRef: [refMenuItem refish ]];
49
50
[commitController rearrangeObjects ];
50
51
}
51
52
}
52
53
53
54
- (void ) removeRef : (PBRefMenuItem *)sender
54
55
{
55
- NSString *ref_desc = [NSString stringWithFormat: @" %@ %@ " , [[sender ref ] type ], [[sender ref ] shortName ]];
56
+ NSString *ref_desc = [NSString stringWithFormat: @" %@ %@ " , [(PBGitRef *) [sender refish ] type ], [[sender refish ] shortName ]];
56
57
NSString *question = [NSString stringWithFormat: @" Are you sure you want to remove the %@ ?" , ref_desc];
57
58
NSBeginAlertSheet ([NSString stringWithFormat: @" Delete %@ ?" , ref_desc], @" Delete" , @" Cancel" , nil , [[historyController view ] window ], self, @selector (removeRefSheetDidEnd:returnCode:contextInfo: ), NULL , sender, question);
58
59
}
59
60
60
61
- (void ) checkoutRef : (PBRefMenuItem *)sender
61
62
{
62
63
int ret = 1 ;
63
- [historyController.repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" checkout" , [[sender ref ] shortName ], nil ] retValue: &ret];
64
+ [historyController.repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" checkout" , [[sender refish ] shortName ], nil ] retValue: &ret];
64
65
if (ret) {
65
66
[[historyController.repository windowController ] showMessageSheet: @" Checking out branch failed" infoText: @" There was an error checking out the branch. Perhaps your working directory is not clean?" ];
66
67
return ;
@@ -71,22 +72,30 @@ - (void) checkoutRef:(PBRefMenuItem *)sender
71
72
72
73
- (void ) tagInfo : (PBRefMenuItem *)sender
73
74
{
74
- NSString *message = [NSString stringWithFormat: @" Info for tag: %@ " , [[sender ref ] shortName ]];
75
+ NSString *message = [NSString stringWithFormat: @" Info for tag: %@ " , [[sender refish ] shortName ]];
75
76
76
77
int ret = 1 ;
77
- NSString *info = [historyController.repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" tag" , @" -n50" , @" -l" , [[sender ref ] shortName ], nil ] retValue: &ret];
78
+ NSString *info = [historyController.repository outputInWorkdirForArguments: [NSArray arrayWithObjects: @" tag" , @" -n50" , @" -l" , [[sender refish ] shortName ], nil ] retValue: &ret];
78
79
79
80
if (!ret) {
80
81
[[historyController.repository windowController ] showMessageSheet: message infoText: info];
81
82
}
82
83
return ;
83
84
}
84
85
85
- - (NSArray *) menuItemsForRef : (PBGitRef *)ref commit : (PBGitCommit *)commit
86
+ #pragma mark Contextual menus
87
+
88
+ - (NSArray *) menuItemsForRef : (PBGitRef *)ref
86
89
{
87
- return [PBRefMenuItem defaultMenuItemsForRef: ref commit: commit target: self ];
90
+ return [PBRefMenuItem defaultMenuItemsForRef: ref inRepository: historyController.repository target: self ];
88
91
}
89
92
93
+ - (NSArray *) menuItemsForCommit : (PBGitCommit *)commit
94
+ {
95
+ return [PBRefMenuItem defaultMenuItemsForCommit: commit target: self ];
96
+ }
97
+
98
+
90
99
# pragma mark Tableview delegate methods
91
100
92
101
- (BOOL )tableView : (NSTableView *)tv writeRowsWithIndexes : (NSIndexSet *)rowIndexes toPasteboard : (NSPasteboard *)pboard
0 commit comments