Skip to content

Commit 21b8f38

Browse files
committed
Improved overall performance (in particular when opening repositories), by only reloading the refs when it's really necessary. This also fixes #188 as the branch badges are correctly calculated on startup.
1 parent b57c1b4 commit 21b8f38

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

PBGitRepository.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,13 @@ - (void) setup
186186
{
187187
config = [[PBGitConfig alloc] initWithRepositoryPath:[[self fileURL] path]];
188188
self.branches = [NSMutableArray array];
189-
[self reloadRefs];
190189
currentBranchFilter = [PBGitDefaults branchFilter];
191190
revisionList = [[PBGitHistoryList alloc] initWithRepository:self];
192-
193191
resetController = [[PBGitResetController alloc] initWithRepository:self];
194192
stashController = [[PBStashController alloc] initWithRepository:self];
195193
submoduleController = [[PBSubmoduleController alloc] initWithRepository:self];
194+
[self reloadRefs];
195+
[self readCurrentBranch];
196196
}
197197

198198
- (void)close

PBGitSidebarController.m

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ - (void)awakeFromNib
8484

8585
[sourceView setDoubleAction:@selector(outlineDoubleClicked)];
8686
[sourceView setTarget:self];
87+
[self updateMetaDataForBranches];
8788
}
8889

8990
- (void)closeView
@@ -162,15 +163,14 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
162163
for(PBGitSVRemoteItem* remote in [remotes children]){
163164
[self performSelectorInBackground:@selector(evaluateRemoteBadge:) withObject:remote];
164165
}
165-
166-
[self updateMetaDataforBranches:branches];
166+
[self updateMetaDataForBranches];
167167
}else{
168168
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
169169
}
170170
}
171171

172172

173-
-(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches
173+
-(void)updateMetaDataForBranches:(PBSourceViewItem *)theBranches
174174
{
175175
for(PBGitSVBranchItem* branch in [theBranches children]){
176176
if([branch isKindOfClass:[PBGitSVBranchItem class]]){
@@ -184,11 +184,15 @@ -(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches
184184
});
185185
});
186186
}else if ([branch isKindOfClass:[PBGitSVFolderItem class]]) {
187-
[self updateMetaDataforBranches: branch];
187+
[self updateMetaDataForBranches: branch];
188188
}
189189
}
190190
}
191191

192+
-(void)updateMetaDataForBranches
193+
{
194+
[self updateMetaDataForBranches: branches];
195+
}
192196

193197
#pragma mark Badges Methods
194198

PBGitWindowController.m

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ - (void) changeContentController:(PBViewController *)controller
135135

136136
[self setNextResponder: contentController];
137137
[[self window] makeFirstResponder:[contentController firstResponder]];
138-
[contentController updateView];
139138
[contentController addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionInitial context:@"statusChange"];
140139
}
141140

0 commit comments

Comments
 (0)