File tree Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Expand file tree Collapse file tree 4 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,11 @@ - (instancetype)initWithReference:(GTReference *)ref {
8787}
8888
8989- (NSString *)name {
90- return self.reference .name ;
90+ const char *charName;
91+ int gitError = git_branch_name (&charName, self.reference .git_reference );
92+ if (gitError != GIT_OK || charName == NULL ) return nil ;
93+
94+ return @(charName);
9195}
9296
9397- (NSString *)shortName {
Original file line number Diff line number Diff line change @@ -158,7 +158,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er
158158 NSArray *parents = @[ localCommit, remoteCommit ];
159159
160160 // FIXME: This is stepping on the local tree
161- GTCommit *mergeCommit = [self createCommitWithTree: newTree message: message parents: parents updatingReferenceNamed: localBranch.name error: error];
161+ GTCommit *mergeCommit = [self createCommitWithTree: newTree message: message parents: parents updatingReferenceNamed: localBranch.reference .name error: error];
162162 if (!mergeCommit) {
163163 return NO ;
164164 }
Original file line number Diff line number Diff line change 3535 expect (error).to (beNil ());
3636});
3737
38+ describe (@" name" , ^{
39+ it (@" should use just the branch name for a local branch" , ^{
40+ expect (masterBranch.name ).to (equal (@" master" ));
41+ });
42+
43+ it (@" should include the remote name for a tracking branch" , ^{
44+ expect (trackingBranch.name ).to (equal (@" origin/master" ));
45+ });
46+ });
47+
3848describe (@" shortName" , ^{
3949 it (@" should use just the branch name for a local branch" , ^{
4050 expect (masterBranch.shortName ).to (equal (@" master" ));
Original file line number Diff line number Diff line change 292292 GTBranch *currentBranch = [repository currentBranchWithError: &error];
293293 expect (currentBranch).notTo (beNil ());
294294 expect (error).to (beNil ());
295- expect (currentBranch.name ).to (equal (@" refs/heads/ master" ));
295+ expect (currentBranch.name ).to (equal (@" master" ));
296296 });
297297});
298298
332332 expect (error).to (beNil ());
333333 expect (@(branches.count )).to (equal (@1 ));
334334 GTBranch *remoteBranch = branches[0 ];
335- expect (remoteBranch.name ).to (equal (@" refs/remotes/ origin/master" ));
335+ expect (remoteBranch.name ).to (equal (@" origin/master" ));
336336 });
337337});
338338
You can’t perform that action at this time.
0 commit comments