Hey,

On Sat, Mar 27, 2010 at 11:55 PM,  <[email protected]> wrote:
> From: Nathan Kinsinger <[email protected]>
>
> These add functionality and improve readability.

Good idea

> +- (NSString *)remoteName
> +{
> +       if (![self isRemote])
> +               return nil;
> +
> +       return (NSString *)[[ref componentsSeparatedByString:@"/"] 
> objectAtIndex:2];
> +}
> +
> +- (NSString *)remoteBranchName
> +{
> +       if (![self isRemoteBranch])
> +               return nil;
> +
> +       return [[self shortName] substringFromIndex:[[self remoteName] 
> length] + 1];
> +}

This feels a bit icky to me. Isn't there a more solid way to do this?
take git-svn's default behaviour for example, which creates a single
branch refs/remotes/git-svn


> +- (BOOL)isBranch
> +{
> +       return [ref hasPrefix:kGitXBranchRefPrefix];
> +}
> +
> +- (BOOL)isTag
> +{
> +       return [ref hasPrefix:kGitXTagRefPrefix];
> +}
> +
> +- (BOOL)isRemote
> +{
> +       return [ref hasPrefix:kGitXRemoteRefPrefix];
> +}

Good to use constants here!

> +- (BOOL)isRemoteBranch
> +{
> +       if (![self isRemote])
> +               return NO;
> +
> +       return ([[ref componentsSeparatedByString:@"/"] count] > 3);
> +}

I think this also fails with git-svn's refs/remotes/git-svn branch

> +- (PBGitRef *)remoteRef
> +{
> +       if (![self isRemote])
> +               return nil;
> +
> +       return [PBGitRef refFromString:[kGitXRemoteRefPrefix 
> stringByAppendingString:[self remoteName]]];
> +}

I think this might return a non-valid ref (only a directory), like
'refs/remotes/origin'.. perhaps another name is more clear?

To unsubscribe from this group, send email to gitx+unsubscribegooglegroups.com 
or reply to this email with the words "REMOVE ME" as the subject.

Reply via email to