Skip to content

Commit 0f15dfe

Browse files
committed
Add -[GTBranch isHEAD]
1 parent 8a67e08 commit 0f15dfe

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ObjectiveGit/GTBranch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
5050
@property (nonatomic, readonly) GTBranchType branchType;
5151
@property (nonatomic, readonly, strong) GTRepository *repository;
5252
@property (nonatomic, readonly, strong) GTReference *reference;
53+
@property (nonatomic, readonly, getter=isHEAD) BOOL HEAD;
5354

5455
+ (NSString *)localNamePrefix;
5556
+ (NSString *)remoteNamePrefix;

ObjectiveGit/GTBranch.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ - (GTBranchType)branchType {
152152
}
153153
}
154154

155+
- (BOOL)isHEAD {
156+
return (git_branch_is_head(self.reference.git_reference) ? YES : NO);
157+
}
158+
155159
- (NSArray *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error {
156160
GTEnumerator *enumerator = [self.repository enumeratorForUniqueCommitsFromOID:self.OID relativeToOID:otherBranch.OID error:error];
157161
return [enumerator allObjectsWithError:error];

0 commit comments

Comments
 (0)