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 @@ - (nullable 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 @@ -159,7 +159,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er
159159 NSArray *parents = @[ localCommit, remoteCommit ];
160160
161161 // FIXME: This is stepping on the local tree
162- GTCommit *mergeCommit = [self createCommitWithTree: newTree message: message parents: parents updatingReferenceNamed: localBranch.name error: error];
162+ GTCommit *mergeCommit = [self createCommitWithTree: newTree message: message parents: parents updatingReferenceNamed: localBranch.reference .name error: error];
163163 if (!mergeCommit) {
164164 return NO ;
165165 }
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 268268 GTBranch *currentBranch = [repository currentBranchWithError: &error];
269269 expect (currentBranch).notTo (beNil ());
270270 expect (error).to (beNil ());
271- expect (currentBranch.name ).to (equal (@" refs/heads/ master" ));
271+ expect (currentBranch.name ).to (equal (@" master" ));
272272 });
273273});
274274
308308 expect (error).to (beNil ());
309309 expect (@(branches.count )).to (equal (@1 ));
310310 GTBranch *remoteBranch = branches[0 ];
311- expect (remoteBranch.name ).to (equal (@" refs/remotes/ origin/master" ));
311+ expect (remoteBranch.name ).to (equal (@" origin/master" ));
312312 });
313313});
314314
You can’t perform that action at this time.
0 commit comments