Files
gitx/PBStashContentController.m
2011-06-16 17:54:42 -06:00

47 lines
1.2 KiB
Objective-C

//
// PBStashContentController.h
// GitX
//
// Created by David Catmull on 20-06-11.
// Copyright 2011. All rights reserved.
//
#import "PBStashContentController.h"
#import "PBGitCommit.h"
#import "PBGitDefaults.h"
#import "PBGitStash.h"
const CGFloat kMinPaneSize = 32.0;
@implementation PBStashContentController
- (void) awakeFromNib
{
[unstagedController setRepository:repository];
[stagedController setRepository:repository];
}
- (void) showStash:(PBGitStash*)stash
{
NSString *stashRef = [NSString stringWithFormat:@"refs/%@", [stash name]];
NSString *stashSHA = [repository shaForRef:[PBGitRef refFromString:stashRef]];
PBGitCommit *commit = [repository commitForSHA:stashSHA];
NSString *indexSHA = [commit.parents objectAtIndex:1];
PBGitCommit *indexCommit = [repository commitForSHA:indexSHA];
[unstagedController changeContentTo:commit];
[stagedController changeContentTo:indexCommit];
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
{
return kMinPaneSize;
}
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
{
return [splitView frame].size.height - kMinPaneSize;
}
@end