Also readBranches when opening as a NSDocument.

This commit is contained in:
Pieter de Bie
2008-08-18 22:26:34 +02:00
parent bcd6d88851
commit eeca836454
2 changed files with 1 additions and 27 deletions
-3
View File
@@ -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;
+1 -24
View File
@@ -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];