mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
Also readBranches when opening as a NSDocument.
This commit is contained in:
@@ -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
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user