Skip to content

Commit f2fc162

Browse files
committed
Make reloadRefs realize when something has gone horribly wrong.
1 parent 9e140f1 commit f2fc162

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

PBGitRepository.m

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ - (void) addRef: (PBGitRef *) ref fromParameters: (NSArray *) components
280280
else
281281
sha = [PBGitSHA shaWithString:[components objectAtIndex:2]];
282282

283+
if(!sha) {
284+
NSLog(@"sha was nil...? ref=%@, components=%@",ref,components);
285+
return;
286+
}
287+
283288
NSMutableArray* curRefs;
284289
if ( (curRefs = [refs objectForKey:sha]) != nil )
285290
[curRefs addObject:ref];
@@ -299,6 +304,13 @@ - (void) reloadRefs
299304
NSString *output = [self outputForArguments:arguments];
300305
NSArray *lines = [output componentsSeparatedByString:@"\n"];
301306

307+
if([output hasPrefix:@"fatal: "]) {
308+
NSLog(@"Unable to read refs!");
309+
NSLog(@"arguments=%@",arguments);
310+
NSLog(@"output=%@",output);
311+
@throw output;
312+
}
313+
302314
for (NSString *line in lines) {
303315
// If its an empty line, skip it (e.g. with empty repositories)
304316
if ([line length] == 0)

0 commit comments

Comments
 (0)