File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,13 @@ - (void) awakeFromNib
2424- (void ) showStash : (PBGitStash*)stash
2525{
2626 NSString *stashRef = [NSString stringWithFormat: @" refs/%@ " , [stash name ]];
27- NSString *stashSha = [repository shaForRef: [PBGitRef refFromString: stashRef]];
28- PBGitCommit *commit = [PBGitCommit commitWithRepository: repository andSha: stashSha];
27+ NSString *stashSHA = [repository shaForRef: [PBGitRef refFromString: stashRef]];
28+ PBGitCommit *commit = [repository commitForSHA: stashSHA];
29+ NSString *indexSHA = [commit.parents objectAtIndex: 1 ];
30+ PBGitCommit *indexCommit = [repository commitForSHA: indexSHA];
2931
3032 [unstagedController changeContentTo: commit];
33+ [stagedController changeContentTo: indexCommit];
3134}
3235
3336- (CGFloat)splitView : (NSSplitView *)splitView constrainMinCoordinate : (CGFloat)proposedMin ofSubviewAt : (NSInteger )dividerIndex
Original file line number Diff line number Diff line change 3232- (NSString *) refsForCurrentCommit ;
3333// Look up a PBGitRef based on its SHA.
3434- (PBGitRef*) refFromString : (NSString *)refString ;
35+ // Choose which parents should be used for the diff
36+ - (NSArray *) chooseDiffParents : (NSArray *)parents ;
3537// Context menu items to be displayed for a file.
3638- (NSArray *) menuItemsForPath : (NSString *)path ;
3739
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ - (void)commitDetailsLoaded:(NSNotification *)notification
104104 }
105105 }
106106
107- NSString *parents = [parentsArray componentsJoinedByString: @" " ];
107+ NSString *parents = [[ self chooseDiffParents: parentsArray] componentsJoinedByString: @" " ];
108108
109109 // File Stats
110110 NSMutableDictionary *stats = [self parseStats: details];
@@ -136,6 +136,11 @@ - (NSString*) refsForCurrentCommit
136136 return @" " ;
137137}
138138
139+ - (NSArray *) chooseDiffParents : (NSArray *)parents
140+ {
141+ return parents;
142+ }
143+
139144- (NSMutableDictionary *)parseStats : (NSString *)txt
140145{
141146 NSArray *lines = [txt componentsSeparatedByString: @" \n " ];
Original file line number Diff line number Diff line change @@ -19,4 +19,9 @@ - (NSArray*) menuItemsForPath:(NSString*)path
1919 return [[stashController superController ] menuItemsForPaths: [NSArray arrayWithObject: path]];
2020}
2121
22+ - (NSArray *) chooseDiffParents : (NSArray *)parents
23+ {
24+ return [NSArray arrayWithObject: [parents objectAtIndex: 0 ]];
25+ }
26+
2227@end
You can’t perform that action at this time.
0 commit comments