File tree Expand file tree Collapse file tree 2 files changed +17
-27
lines changed Expand file tree Collapse file tree 2 files changed +17
-27
lines changed Original file line number Diff line number Diff line change @@ -648,7 +648,10 @@ - (NSArray *)menuItemsForPaths:(NSArray *)paths
648
648
{
649
649
if ([sender isKindOfClass: [PBRefMenuItem class ]]) {
650
650
id <PBGitRefish> refish = [[(PBRefMenuItem *)sender refishs ] firstObject ];
651
- return refish;
651
+
652
+ if (!types || [types indexOfObject: [refish refishType ]] != NSNotFound )
653
+ return refish;
654
+ return nil ;
652
655
}
653
656
654
657
if ([types indexOfObject: kGitXCommitType ] == NSNotFound )
@@ -810,6 +813,19 @@ - (IBAction)showDeleteRefSheet:(PBRefMenuItem *)sender
810
813
}];
811
814
}
812
815
816
+ - (IBAction )diffWithHEAD : (id )sender
817
+ {
818
+ id <PBGitRefish> refish = [self refishForSender: sender refishTypes: nil ];
819
+ if (!refish)
820
+ return ;
821
+
822
+ PBGitCommit *commit = [self .repository commitForRef: refish];
823
+
824
+ NSString *diff = [self .repository performDiff: commit against: nil forFiles: nil ];
825
+
826
+ [PBDiffWindowController showDiff: diff];
827
+ }
828
+
813
829
#pragma mark -
814
830
#pragma mark Quick Look
815
831
Original file line number Diff line number Diff line change @@ -26,32 +26,6 @@ - (void)awakeFromNib
26
26
[commitList registerForDraggedTypes: [NSArray arrayWithObject: @" PBGitRef" ]];
27
27
}
28
28
29
- - (NSArray <PBGitCommit *> *) commitsForMenuItem : (PBRefMenuItem *)menuItem {
30
- NSArray <id <PBGitRefish>> * refishs = menuItem.refishs ;
31
- NSMutableArray *commits = [NSMutableArray arrayWithCapacity: refishs.count];
32
- for (id <PBGitRefish> refish in refishs) {
33
- [commits addObject: [self refishToCommit: refish]];
34
- }
35
- return commits;
36
- }
37
-
38
- - (PBGitCommit *) refishToCommit : (id <PBGitRefish>)refish {
39
- return [refish refishType ] == kGitXCommitType
40
- ? (PBGitCommit *)refish
41
- : [historyController.repository commitForRef: refish];
42
- }
43
-
44
-
45
- #pragma mark Diff
46
-
47
- - (void ) diffWithHEAD : (PBRefMenuItem *)sender
48
- {
49
- PBGitCommit *commit = [self commitsForMenuItem: sender].firstObject ;
50
- NSString *diff = [historyController.repository performDiff: commit against: nil forFiles: nil ];
51
-
52
- [PBDiffWindowController showDiff: diff];
53
- }
54
-
55
29
#pragma mark Stash
56
30
57
31
- (IBAction ) stashPop : (PBRefMenuItem *)sender
You can’t perform that action at this time.
0 commit comments