Skip to content

Commit 234283b

Browse files
committed
Update branch meta data, even if the branch has slashes in its name (i.e. represented in folders).
1 parent 57dae2b commit 234283b

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

PBGitSidebarController.m

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -163,25 +163,33 @@ - (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(
163163
[self performSelectorInBackground:@selector(evaluateRemoteBadge:) withObject:remote];
164164
}
165165

166-
for(PBGitSVBranchItem* branch in [branches children]){
167-
if([branch isKindOfClass:[PBGitSVBranchItem class]]){
168-
NSString *bName=[branch title];
169-
dispatch_async(PBGetWorkQueue(),^{
170-
id ahead = [self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",bName,bName]];
171-
id behind = [self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",bName,bName]];
172-
dispatch_async(dispatch_get_main_queue(),^{
173-
[branch setAhead:ahead];
174-
[branch setBehind:behind];
175-
[branch setIsCheckedOut:[branch.revSpecifier isEqual:[repository headRef]]];
176-
});
177-
});
178-
}
179-
}
166+
[self updateMetaDataforBranches:branches];
180167
}else{
181168
[super observeValueForKeyPath:keyPath ofObject:object change:change context:context];
182169
}
183170
}
184171

172+
173+
-(void)updateMetaDataforBranches:(PBSourceViewItem *)theBranches
174+
{
175+
for(PBGitSVBranchItem* branch in [theBranches children]){
176+
if([branch isKindOfClass:[PBGitSVBranchItem class]]){
177+
dispatch_async(PBGetWorkQueue(),^{
178+
id ahead = [self countCommintsOf:[NSString stringWithFormat:@"origin/%@..%@",branch.revSpecifier,branch.revSpecifier]];
179+
id behind = [self countCommintsOf:[NSString stringWithFormat:@"%@..origin/%@",branch.revSpecifier,branch.revSpecifier]];
180+
dispatch_async(dispatch_get_main_queue(),^{
181+
[branch setAhead:ahead];
182+
[branch setBehind:behind];
183+
[branch setIsCheckedOut:[branch.revSpecifier isEqual:[repository headRef]]];
184+
});
185+
});
186+
}else if ([branch isKindOfClass:[PBGitSVFolderItem class]]) {
187+
[self updateMetaDataforBranches: branch];
188+
}
189+
}
190+
}
191+
192+
185193
#pragma mark Badges Methods
186194

187195
-(void)evaluateRemoteBadge:(PBGitSVRemoteItem *)remote

0 commit comments

Comments
 (0)