Skip to content

Commit 26ada64

Browse files
author
David Catmull
committed
show index in lower pane
1 parent 0659d79 commit 26ada64

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

PBStashContentController.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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

PBWebCommitController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
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

PBWebCommitController.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff 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"];

PBWebStashController.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)