diff --git a/PBGitRepository.h b/PBGitRepository.h index 00dabe7..6795a22 100644 --- a/PBGitRepository.h +++ b/PBGitRepository.h @@ -16,9 +16,6 @@ extern NSString* PBGitRepositoryErrorDomain; NSArray* branches; } -+ (PBGitRepository*) repositoryWithPath:(NSString*) path; -- (PBGitRepository*) initWithPath:(NSString*) path; - - (NSFileHandle*) handleForCommand:(NSString*) cmd; - (NSFileHandle*) handleForArguments:(NSArray*) args; diff --git a/PBGitRepository.m b/PBGitRepository.m index 38f2264..9c2f7d9 100644 --- a/PBGitRepository.m +++ b/PBGitRepository.m @@ -99,6 +99,7 @@ static NSString* gitPath; if (success) { revisionList = [[PBGitRevList alloc] initWithRepository:self andRevListParameters:[NSArray array]]; + [self readBranches]; } } @@ -123,30 +124,6 @@ static NSString* gitPath; [controller release]; } -+ (PBGitRepository*) repositoryWithPath:(NSString*) path -{ - PBGitRepository* repo = [[PBGitRepository alloc] initWithPath: path]; - return repo; -} - -- (PBGitRepository*) initWithPath: (NSString*) p -{ - if ([p hasSuffix:@".git"]) - [self setFileURL:[NSURL fileURLWithPath:p]]; - else { - NSString* newPath = [PBEasyPipe outputForCommand:gitPath withArgs:[NSArray arrayWithObjects:@"rev-parse", @"--git-dir", nil] inDir:p]; - if ([newPath isEqualToString:@".git"]) - [self setFileURL:[NSURL fileURLWithPath:[p stringByAppendingPathComponent:@".git"]]]; - else - [self setFileURL:[NSURL fileURLWithPath:newPath]]; - } - - NSLog(@"Git path is: %@", self.fileURL); - revisionList = [[PBGitRevList alloc] initWithRepository:self andRevListParameters:[NSArray array]]; - [self readBranches]; - return self; -} - - (void) readBranches { NSString* output = [PBEasyPipe outputForCommand:gitPath withArgs:[NSArray arrayWithObjects:@"for-each-ref", @"refs/heads", nil] inDir: self.fileURL.path];