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 {
87
87
}
88
88
89
89
- (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);
91
95
}
92
96
93
97
- (NSString *)shortName {
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er
159
159
NSArray *parents = @[ localCommit, remoteCommit ];
160
160
161
161
// 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];
163
163
if (!mergeCommit) {
164
164
return NO ;
165
165
}
Original file line number Diff line number Diff line change 34
34
expect (error).to (beNil ());
35
35
});
36
36
37
+ describe (@" name" , ^{
38
+ it (@" should use just the branch name for a local branch" , ^{
39
+ expect (masterBranch.name ).to (equal (@" master" ));
40
+ });
41
+
42
+ it (@" should include the remote name for a tracking branch" , ^{
43
+ expect (trackingBranch.name ).to (equal (@" origin/master" ));
44
+ });
45
+ });
46
+
37
47
describe (@" shortName" , ^{
38
48
it (@" should use just the branch name for a local branch" , ^{
39
49
expect (masterBranch.shortName ).to (equal (@" master" ));
Original file line number Diff line number Diff line change 268
268
GTBranch *currentBranch = [repository currentBranchWithError: &error];
269
269
expect (currentBranch).notTo (beNil ());
270
270
expect (error).to (beNil ());
271
- expect (currentBranch.name ).to (equal (@" refs/heads/ master" ));
271
+ expect (currentBranch.name ).to (equal (@" master" ));
272
272
});
273
273
});
274
274
308
308
expect (error).to (beNil ());
309
309
expect (@(branches.count )).to (equal (@1 ));
310
310
GTBranch *remoteBranch = branches[0 ];
311
- expect (remoteBranch.name ).to (equal (@" refs/remotes/ origin/master" ));
311
+ expect (remoteBranch.name ).to (equal (@" origin/master" ));
312
312
});
313
313
});
314
314
You can’t perform that action at this time.
0 commit comments