Skip to content

Commit 1b9e07c

Browse files
committed
Merge pull request brotherbard#79 from Uncommon/stashview
Fixes for stash display
2 parents ee67330 + ba51ae8 commit 1b9e07c

19 files changed

+777
-522
lines changed

GitX.xcodeproj/project.pbxproj

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
65D58BC7132D48C2003F7290 /* PBResetSheet.m in Sources */ = {isa = PBXBuildFile; fileRef = 65D58BC6132D48C0003F7290 /* PBResetSheet.m */; };
8181
770B37ED0679A11B001EADE2 /* GitTest_DataModel.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 770B37EC0679A11B001EADE2 /* GitTest_DataModel.xcdatamodel */; };
8282
77C8280E06725ACE000B614F /* ApplicationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 77C8280C06725ACE000B614F /* ApplicationController.m */; };
83+
89087CA613A3E46B00911503 /* PBWebCommitController.m in Sources */ = {isa = PBXBuildFile; fileRef = 89087CA513A3E46B00911503 /* PBWebCommitController.m */; };
84+
8998B1C613A55B3500121729 /* PBWebStashController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8998B1C513A55B3500121729 /* PBWebStashController.m */; };
8385
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8486
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8587
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@@ -335,6 +337,10 @@
335337
77C82804067257F0000B614F /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
336338
77C8280B06725ACE000B614F /* ApplicationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ApplicationController.h; sourceTree = "<group>"; };
337339
77C8280C06725ACE000B614F /* ApplicationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ApplicationController.m; sourceTree = "<group>"; };
340+
89087CA413A3E46500911503 /* PBWebCommitController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBWebCommitController.h; sourceTree = "<group>"; };
341+
89087CA513A3E46B00911503 /* PBWebCommitController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBWebCommitController.m; sourceTree = "<group>"; };
342+
8998B1AC13A55AC100121729 /* PBWebStashController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBWebStashController.h; sourceTree = "<group>"; };
343+
8998B1C513A55B3500121729 /* PBWebStashController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBWebStashController.m; sourceTree = "<group>"; };
338344
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
339345
8D1107320486CEB800E47090 /* GitX.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GitX.app; sourceTree = BUILT_PRODUCTS_DIR; };
340346
911111E10E58BD5A00BF76B4 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/RepositoryWindow.xib; sourceTree = "<group>"; };
@@ -846,6 +852,17 @@
846852
name = Models;
847853
sourceTree = "<group>";
848854
};
855+
8998B1AB13A55A9B00121729 /* Stash */ = {
856+
isa = PBXGroup;
857+
children = (
858+
DDB8FDFF13998CE2001A9EE2 /* PBStashContentController.h */,
859+
DDB8FE0013998CE2001A9EE2 /* PBStashContentController.m */,
860+
8998B1AC13A55AC100121729 /* PBWebStashController.h */,
861+
8998B1C513A55B3500121729 /* PBWebStashController.m */,
862+
);
863+
name = Stash;
864+
sourceTree = "<group>";
865+
};
849866
913D5E420E5563FD00CECEA2 /* cli */ = {
850867
isa = PBXGroup;
851868
children = (
@@ -941,18 +958,19 @@
941958
F5EF8C880E9D498F0050906B /* History */,
942959
F5E927F90E883EF600056E75 /* Commit */,
943960
D82F435F111B9C6D00A25A39 /* Sheets */,
961+
8998B1AB13A55A9B00121729 /* Stash */,
944962
77C8280B06725ACE000B614F /* ApplicationController.h */,
945963
77C8280C06725ACE000B614F /* ApplicationController.m */,
946964
93CB42C00EAB7B2200530609 /* PBGitDefaults.h */,
947965
93CB42C10EAB7B2200530609 /* PBGitDefaults.m */,
948-
DDB8FDFF13998CE2001A9EE2 /* PBStashContentController.h */,
949-
DDB8FE0013998CE2001A9EE2 /* PBStashContentController.m */,
950966
F57CC43F0E05E496000472E2 /* PBGitWindowController.h */,
951967
F57CC4400E05E496000472E2 /* PBGitWindowController.m */,
952968
911111F60E594F3F00BF76B4 /* PBRepositoryDocumentController.h */,
953969
911111F70E594F3F00BF76B4 /* PBRepositoryDocumentController.m */,
954970
F5E926040E8827D300056E75 /* PBViewController.h */,
955971
F5E926050E8827D300056E75 /* PBViewController.m */,
972+
89087CA413A3E46500911503 /* PBWebCommitController.h */,
973+
89087CA513A3E46B00911503 /* PBWebCommitController.m */,
956974
F5EF8C8C0E9D4A5D0050906B /* PBWebController.h */,
957975
F5EF8C8D0E9D4A5D0050906B /* PBWebController.m */,
958976
F5FE6C010EB13BC900F30D12 /* PBServicesController.h */,
@@ -1204,7 +1222,6 @@
12041222
isa = PBXProject;
12051223
buildConfigurationList = 26FC0A880875C7B200E6366F /* Build configuration list for PBXProject "GitX" */;
12061224
compatibilityVersion = "Xcode 3.1";
1207-
developmentRegion = English;
12081225
hasScannedForEncodings = 1;
12091226
knownRegions = (
12101227
English,
@@ -1457,6 +1474,8 @@
14571474
65D58BC7132D48C2003F7290 /* PBResetSheet.m in Sources */,
14581475
31776089133569350025876E /* SearchWebView.m in Sources */,
14591476
DDB8FE0113998CE2001A9EE2 /* PBStashContentController.m in Sources */,
1477+
89087CA613A3E46B00911503 /* PBWebCommitController.m in Sources */,
1478+
8998B1C613A55B3500121729 /* PBWebStashController.m in Sources */,
14601479
);
14611480
runOnlyForDeploymentPostprocessing = 0;
14621481
};

PBGitHistoryController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// PBGitHistoryView.h
2+
// PBGitHistoryController.h
33
// GitX
44
//
55
// Created by Pieter de Bie on 19-09-08.

PBGitHistoryController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// PBGitHistoryView.m
2+
// PBGitHistoryController.m
33
// GitX
44
//
55
// Created by Pieter de Bie on 19-09-08.

PBGitSidebarController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
PBGitHistoryController *historyViewController;
3636
PBGitCommitController *commitViewController;
37-
PBStashContentController *stashViewController;
37+
PBStashContentController *stashViewController;
3838
}
3939

4040
- (void) selectStage;

PBGitWindowController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@
5656
- (IBAction) cloneTo:(id)sender;
5757
- (IBAction) refresh:(id)sender;
5858

59+
- (void)selectCommitForSha:(NSString *)sha;
60+
- (NSArray *)menuItemsForPaths:(NSArray *)paths;
5961
- (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode;
6062

6163
@end

PBGitWindowController.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,18 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
234234
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
235235
}
236236

237+
- (void) selectCommitForSha:(NSString *)sha
238+
{
239+
if (contentController != sidebarController.historyViewController)
240+
[sidebarController selectCurrentBranch];
241+
[sidebarController.historyViewController selectCommit:sha];
242+
}
243+
244+
- (NSArray *) menuItemsForPaths:(NSArray *)paths
245+
{
246+
return [sidebarController.historyViewController menuItemsForPaths:paths];
247+
}
248+
237249
- (void)setHistorySearch:(NSString *)searchString mode:(NSInteger)mode
238250
{
239251
[sidebarController setHistorySearch:searchString mode:mode];

PBStashContentController.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
// Controls the view displaying a stash diff
1616
@interface PBStashContentController : PBViewController {
1717
IBOutlet id webView;
18-
IBOutlet PBWebHistoryController *webController;
18+
IBOutlet PBWebStashController *unstagedController;
19+
IBOutlet PBWebStashController *stagedController;
1920
}
2021

2122
- (void) showStash:(PBGitStash*)stash;

PBStashContentController.m

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,40 @@
77
//
88

99
#import "PBStashContentController.h"
10+
#import "PBGitCommit.h"
1011
#import "PBGitDefaults.h"
1112
#import "PBGitStash.h"
1213

14+
const CGFloat kMinPaneSize = 32.0;
15+
1316
@implementation PBStashContentController
1417

1518
- (void) awakeFromNib
1619
{
17-
[webController setRepository:repository];
20+
[unstagedController setRepository:repository];
21+
[stagedController setRepository:repository];
1822
}
1923

2024
- (void) showStash:(PBGitStash*)stash
2125
{
2226
NSString *stashRef = [NSString stringWithFormat:@"refs/%@", [stash name]];
23-
NSString *stashSha = [repository shaForRef:[PBGitRef refFromString:stashRef]];
24-
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];
31+
32+
[unstagedController changeContentTo:commit];
33+
[stagedController changeContentTo:indexCommit];
34+
}
2535

26-
[webController changeContentTo:commit];
36+
- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
37+
{
38+
return kMinPaneSize;
39+
}
40+
41+
- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
42+
{
43+
return [splitView frame].size.height - kMinPaneSize;
2744
}
2845

2946
@end

0 commit comments

Comments
 (0)