Skip to content

Commit c1d8f15

Browse files
committed
Merge remote-tracking branch 'tiennou/master' into ssp
2 parents a890f7e + 29cf62f commit c1d8f15

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;
@@ -91,6 +94,19 @@ - (void) dealloc
9194
[watcher stop];
9295
}
9396

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

0 commit comments

Comments
 (0)