Skip to content

Commit

Permalink
GitRepository: Add an "all branches" option in branches list
Browse files Browse the repository at this point in the history
This is probably the most common non-branch GitX option, so
let's add it by default
  • Loading branch information
pieter committed Oct 3, 2008
1 parent bae7566 commit ffae6a8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
3 changes: 3 additions & 0 deletions PBGitRepository.m
Expand Up @@ -231,6 +231,9 @@ - (BOOL) reloadRefs
}

self.refs = refs;

// Add an "All branches" option in the branches list
[self addBranch:[PBGitRevSpecifier allBranchesRevSpec]];
return ret;
}

Expand Down
5 changes: 4 additions & 1 deletion PBGitRevSpecifier.h
Expand Up @@ -23,6 +23,9 @@
- (BOOL) hasLeftRight;

- (BOOL) isEqualTo: (PBGitRevSpecifier*) other;
@property(readonly) NSString* description;

+ (PBGitRevSpecifier *)allBranchesRevSpec;

@property(copy) NSString* description;
@property(readonly) NSArray* parameters;
@end
9 changes: 8 additions & 1 deletion PBGitRevSpecifier.m
Expand Up @@ -11,7 +11,7 @@

@implementation PBGitRevSpecifier

@synthesize parameters;
@synthesize parameters, description;

- (id) initWithParameters:(NSArray*) params
{
Expand All @@ -27,6 +27,13 @@ - (id) initWithRef: (PBGitRef*) ref
return self;
}

+ (PBGitRevSpecifier *)allBranchesRevSpec
{
id revspec = [[PBGitRevSpecifier alloc] initWithParameters:[NSArray arrayWithObject:@"--all"]];
[revspec setDescription:@"All branches"];
return revspec;
}

- (BOOL) isSimpleRef
{
return ([parameters count] == 1 && ![[parameters objectAtIndex:0] hasPrefix:@"-"]);
Expand Down

0 comments on commit ffae6a8

Please sign in to comment.