Skip to content

Commit 7d686ba

Browse files
committed
Add isTag and isBranch to GTReference.
1 parent 60b6c7e commit 7d686ba

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Classes/GTReference.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ typedef enum {
5252
// The name of the reference.
5353
@property (nonatomic, readonly, copy) NSString *name;
5454

55+
// Whether this is a tag.
56+
@property (nonatomic, readonly, getter = isTag) BOOL tag;
57+
58+
// Whether this is a local branch.
59+
@property (nonatomic, readonly, getter = isBranch) BOOL branch;
60+
5561
// Whether this is a remote-tracking branch.
5662
@property (nonatomic, readonly, getter = isRemote) BOOL remote;
5763

Classes/GTReference.m

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ - (BOOL)isEqual:(GTReference *)reference {
167167
#pragma mark -
168168
#pragma mark Properties
169169

170+
- (BOOL)isBranch {
171+
return git_reference_is_branch(self.git_reference) != 0;
172+
}
173+
174+
- (BOOL)isTag {
175+
return git_reference_is_tag(self.git_reference) != 0;
176+
}
177+
170178
- (BOOL)isRemote {
171179
return git_reference_is_remote(self.git_reference) != 0;
172180
}

0 commit comments

Comments
 (0)