File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 3232#import " GTRemote.h"
3333#import " GTRepository.h"
3434#import " NSError+Git.h"
35+ #import " NSData+Git.h"
3536
3637#import " git2/branch.h"
3738#import " git2/errors.h"
@@ -110,17 +111,12 @@ - (GTOID *)OID {
110111}
111112
112113- (NSString *)remoteName {
113- if (self.branchType == GTBranchTypeLocal) return nil ;
114-
115- const char *name;
116- int gitError = git_branch_name (&name, self.reference .git_reference );
114+ git_buf remote_name = GIT_BUF_INIT_CONST (0 , NULL );
115+ int gitError = git_branch_remote_name (&remote_name, self.repository .git_repository , self.reference .name .UTF8String );
117116 if (gitError != GIT_OK) return nil ;
118117
119- // Find out where the remote name ends.
120- const char *end = strchr (name, ' /' );
121- if (end == NULL || end == name) return nil ;
122-
123- return [[NSString alloc ] initWithBytes: name length: end - name encoding: NSUTF8StringEncoding];
118+ NSData *data = [NSData git_dataWithBuffer: &remote_name];
119+ return [[NSString alloc ] initWithData: data encoding: NSUTF8StringEncoding];
124120}
125121
126122- (GTCommit *)targetCommitWithError : (NSError **)error {
You can’t perform that action at this time.
0 commit comments