Skip to content

Commit 29cf62f

Browse files
committed
Get the responder chain back in shape after 9335f0e
Fixes ssp/gitx/issues/6.
1 parent 9a04471 commit 29cf62f

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

Classes/Controllers/PBGitRepositoryDocument.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
@class PBGitRepository;
1212
@class PBGitRevSpecifier;
13+
@class PBGitWindowController;
1314

1415
extern NSString *PBGitRepositoryDocumentType;
1516

@@ -30,4 +31,6 @@ extern NSString *PBGitRepositoryDocumentType;
3031

3132
- (void)selectRevisionSpecifier:(PBGitRevSpecifier *)specifier;
3233

34+
- (PBGitWindowController *)windowController;
35+
3336
@end

Classes/Controllers/PBGitRepositoryDocument.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
5454
if (!_repository)
5555
return NO;
5656

57+
[_repository setDocument:self];
58+
5759
return YES;
5860
}
5961

Classes/git/PBGitRepository.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ static NSString * PBStringFromBranchFilterType(PBGitXBranchFilterType type) {
7070
// Designated initializer
7171
- (id)initWithURL:(NSURL *)repositoryURL error:(NSError **)error;
7272

73+
- (void)setDocument:(NSDocument *)document; // Backward-compatibility while PBGitRepository gets "modelized";
74+
7375
- (void) cloneRepositoryToPath:(NSString *)path bare:(BOOL)isBare;
7476
- (void) beginAddRemote:(NSString *)remoteName forURL:(NSString *)remoteURL;
7577
- (void) beginFetchFromRemoteForRef:(PBGitRef *)ref;

Classes/git/PBGitRepository.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#import "PBGitCommit.h"
1111
#import "PBGitIndex.h"
1212
#import "PBGitWindowController.h"
13+
#import "PBGitRepositoryDocument.h"
1314
#import "PBGitBinary.h"
1415

1516
#import "NSFileHandleExt.h"
@@ -32,6 +33,8 @@ @interface PBGitRepository () {
3233
__strong GTOID* _headOID;
3334
__strong GTRepository* _gtRepo;
3435
PBGitIndex *_index;
36+
37+
PBGitRepositoryDocument *_document;
3538
}
3639

3740
@property (nonatomic, strong) NSNumber *hasSVNRepoConfig;
@@ -92,6 +95,19 @@ - (void) dealloc
9295
[watcher stop];
9396
}
9497

98+
#pragma mark -
99+
#pragma mark Backward-compatibility
100+
// PBGitRepository is responsible for both repository actions and document management
101+
// This is here for the time being while the controller code gets updated to use PBGitRepositoryDocument.
102+
103+
- (void)setDocument:(NSDocument *)document {
104+
_document = (PBGitRepositoryDocument *)document;
105+
}
106+
107+
- (PBGitWindowController *)windowController {
108+
return _document.windowController;
109+
}
110+
95111
#pragma mark -
96112
#pragma mark Properties/General methods
97113

0 commit comments

Comments
 (0)