33
33
@interface PBGitRepository ()
34
34
35
35
@property (nonatomic , strong ) NSNumber *hasSVNRepoConfig;
36
+ @property (nonatomic , strong ) PBGitRepositoryWatcher *watcher;
37
+ @property (nonatomic , strong ) PBGitRevSpecifier *headRef; // Caching
38
+ @property (nonatomic , strong ) PBGitSHA* headSha;
39
+ @property (nonatomic , strong ) GTRepository* gtRepo;
36
40
37
41
@end
38
42
39
43
@implementation PBGitRepository
40
44
41
- @synthesize revisionList, branchesSet, currentBranch, refs, hasChanged, submodules;
42
- @synthesize currentBranchFilter;
43
-
44
45
- (BOOL ) isBareRepository
45
46
{
46
47
return self.gtRepo .isBare ;
@@ -105,12 +106,12 @@ - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSEr
105
106
return NO ;
106
107
}
107
108
108
- revisionList = [[PBGitHistoryList alloc ] initWithRepository: self ];
109
+ self. revisionList = [[PBGitHistoryList alloc ] initWithRepository: self ];
109
110
110
111
[self reloadRefs ];
111
112
112
113
// Setup the FSEvents watcher to fire notifications when things change
113
- watcher = [[PBGitRepositoryWatcher alloc ] initWithRepository: self ];
114
+ self. watcher = [[PBGitRepositoryWatcher alloc ] initWithRepository: self ];
114
115
115
116
return YES ;
116
117
}
@@ -127,20 +128,20 @@ - (id) init
127
128
128
129
self.branchesSet = [NSMutableOrderedSet orderedSet ];
129
130
self.submodules = [NSMutableArray array ];
130
- currentBranchFilter = [PBGitDefaults branchFilter ];
131
+ self. currentBranchFilter = [PBGitDefaults branchFilter ];
131
132
return self;
132
133
}
133
134
134
135
- (void )close
135
136
{
136
- [revisionList cleanup ];
137
+ [self . revisionList cleanup ];
137
138
138
139
[super close ];
139
140
}
140
141
141
142
- (void ) forceUpdateRevisions
142
143
{
143
- [revisionList forceUpdate ];
144
+ [self . revisionList forceUpdate ];
144
145
}
145
146
146
147
- (BOOL )isDocumentEdited
@@ -216,10 +217,10 @@ - (void) addRef:(GTReference*)gtRef
216
217
PBGitRef* ref = [[PBGitRef alloc ] initWithString: gtRef.name];
217
218
// NSLog(@"addRef %@ %@ at %@", ref.type, gtRef.name, [sha string]);
218
219
NSMutableArray * curRefs;
219
- if ( (curRefs = [refs objectForKey: sha]) != nil )
220
+ if ( (curRefs = [self . refs objectForKey: sha]) != nil )
220
221
[curRefs addObject: ref];
221
222
else
222
- [refs setObject: [NSMutableArray arrayWithObject: ref] forKey: sha];
223
+ [self . refs setObject: [NSMutableArray arrayWithObject: ref] forKey: sha];
223
224
}
224
225
225
226
int addSubmoduleName (git_submodule *module, const char * name, void * context)
@@ -249,9 +250,9 @@ - (void) loadSubmodules
249
250
- (void ) reloadRefs
250
251
{
251
252
// clear out ref caches
252
- _headRef = nil ;
253
- _headSha = nil ;
254
- self-> refs = [NSMutableDictionary dictionary ];
253
+ self. headRef = nil ;
254
+ self. headSha = nil ;
255
+ self. refs = [NSMutableDictionary dictionary ];
255
256
256
257
NSError * error = nil ;
257
258
NSArray * allRefs = [self .gtRepo referenceNamesWithError: &error];
@@ -296,11 +297,12 @@ - (void) reloadRefs
296
297
297
298
- (void ) lazyReload
298
299
{
299
- if (!hasChanged)
300
+ if (!self. hasChanged ) {
300
301
return ;
302
+ }
301
303
302
304
[self .revisionList updateHistory ];
303
- hasChanged = NO ;
305
+ self. hasChanged = NO ;
304
306
}
305
307
306
308
- (PBGitRevSpecifier *)headRef
@@ -337,9 +339,9 @@ - (PBGitSHA *)shaForRef:(PBGitRef *)ref
337
339
if (!ref)
338
340
return nil ;
339
341
340
- for (PBGitSHA *sha in refs)
342
+ for (PBGitSHA *sha in self. refs )
341
343
{
342
- for (PBGitRef *existingRef in [refs objectForKey: sha])
344
+ for (PBGitRef *existingRef in [self . refs objectForKey: sha])
343
345
{
344
346
if ([existingRef isEqualToRef: ref])
345
347
{
@@ -384,11 +386,11 @@ - (PBGitCommit *)commitForSHA:(PBGitSHA *)sha
384
386
{
385
387
if (!sha)
386
388
return nil ;
387
- NSArray *revList = revisionList.projectCommits ;
389
+ NSArray *revList = self. revisionList .projectCommits ;
388
390
389
391
if (!revList) {
390
- [revisionList forceUpdate ];
391
- revList = revisionList.projectCommits ;
392
+ [self . revisionList forceUpdate ];
393
+ revList = self. revisionList .projectCommits ;
392
394
}
393
395
for (PBGitCommit *commit in revList)
394
396
if ([[commit sha ] isEqual: sha])
@@ -405,7 +407,7 @@ - (BOOL)isOnSameBranch:(PBGitSHA *)branchSHA asSHA:(PBGitSHA *)testSHA
405
407
if ([testSHA isEqual: branchSHA])
406
408
return YES ;
407
409
408
- NSArray *revList = revisionList.projectCommits ;
410
+ NSArray *revList = self. revisionList .projectCommits ;
409
411
410
412
NSMutableSet *searchSHAs = [NSMutableSet setWithObject: branchSHA];
411
413
@@ -1186,6 +1188,6 @@ - (NSURL*) getIndexURL
1186
1188
- (void ) dealloc
1187
1189
{
1188
1190
NSLog (@" Dealloc of repository" );
1189
- [watcher stop ];
1191
+ [self . watcher stop ];
1190
1192
}
1191
1193
@end
0 commit comments