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 32
32
#import " GTRemote.h"
33
33
#import " GTRepository.h"
34
34
#import " NSError+Git.h"
35
+ #import " NSData+Git.h"
35
36
36
37
#import " git2/branch.h"
37
38
#import " git2/errors.h"
@@ -110,17 +111,12 @@ - (GTOID *)OID {
110
111
}
111
112
112
113
- (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 );
117
116
if (gitError != GIT_OK) return nil ;
118
117
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];
124
120
}
125
121
126
122
- (GTCommit *)targetCommitWithError : (NSError **)error {
You can’t perform that action at this time.
0 commit comments