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 {
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 @@ -158,7 +158,7 @@ - (BOOL)mergeBranchIntoCurrentBranch:(GTBranch *)branch withError:(NSError **)er
158
158
NSArray *parents = @[ localCommit, remoteCommit ];
159
159
160
160
// 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];
162
162
if (!mergeCommit) {
163
163
return NO ;
164
164
}
Original file line number Diff line number Diff line change 35
35
expect (error).to (beNil ());
36
36
});
37
37
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
+
38
48
describe (@" shortName" , ^{
39
49
it (@" should use just the branch name for a local branch" , ^{
40
50
expect (masterBranch.shortName ).to (equal (@" master" ));
Original file line number Diff line number Diff line change 292
292
GTBranch *currentBranch = [repository currentBranchWithError: &error];
293
293
expect (currentBranch).notTo (beNil ());
294
294
expect (error).to (beNil ());
295
- expect (currentBranch.name ).to (equal (@" refs/heads/ master" ));
295
+ expect (currentBranch.name ).to (equal (@" master" ));
296
296
});
297
297
});
298
298
332
332
expect (error).to (beNil ());
333
333
expect (@(branches.count )).to (equal (@1 ));
334
334
GTBranch *remoteBranch = branches[0 ];
335
- expect (remoteBranch.name ).to (equal (@" refs/remotes/ origin/master" ));
335
+ expect (remoteBranch.name ).to (equal (@" origin/master" ));
336
336
});
337
337
});
338
338
You can’t perform that action at this time.
0 commit comments