Make reloadRefs realize when something has gone horribly wrong.

This commit is contained in:
Robert Quattlebaum
2011-05-07 11:10:54 -07:00
parent 9e140f1a7d
commit f2fc162350
+12
View File
@@ -280,6 +280,11 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
else
sha = [PBGitSHA shaWithString:[components objectAtIndex:2]];
if(!sha) {
NSLog(@"sha was nil...? ref=%@, components=%@",ref,components);
return;
}
NSMutableArray* curRefs;
if ( (curRefs = [refs objectForKey:sha]) != nil )
[curRefs addObject:ref];
@@ -299,6 +304,13 @@ NSString* PBGitRepositoryErrorDomain = @"GitXErrorDomain";
NSString *output = [self outputForArguments:arguments];
NSArray *lines = [output componentsSeparatedByString:@"\n"];
if([output hasPrefix:@"fatal: "]) {
NSLog(@"Unable to read refs!");
NSLog(@"arguments=%@",arguments);
NSLog(@"output=%@",output);
@throw output;
}
for (NSString *line in lines) {
// If its an empty line, skip it (e.g. with empty repositories)
if ([line length] == 0)