@@ -35,32 +35,47 @@ typedef NS_ENUM(NSInteger, GTBranchType) {
3535 GTBranchTypeRemote = GIT_BRANCH_REMOTE,
3636};
3737
38+ NS_ASSUME_NONNULL_BEGIN
39+
3840// / A git branch object.
3941// /
40- // / Branches are considered to be equivalent iff both their `name` and `SHA` are
42+ // / Branches are considered to be equivalent if both their `name` and `SHA` are
4143// / equal.
4244@interface GTBranch : NSObject
4345
44- @property (nonatomic , readonly ) NSString *name;
45- @property (nonatomic , readonly ) NSString *shortName;
46- @property (nonatomic , copy , readonly ) GTOID *OID;
47- @property (nonatomic , readonly ) NSString *remoteName;
46+ @property (nonatomic , readonly , nullable ) NSString *name;
47+ @property (nonatomic , readonly , nullable ) NSString *shortName;
48+ @property (nonatomic , copy , readonly , nullable ) GTOID *OID;
49+ @property (nonatomic , readonly , nullable ) NSString *remoteName;
4850@property (nonatomic , readonly ) GTBranchType branchType;
4951@property (nonatomic , readonly , strong ) GTRepository *repository;
5052@property (nonatomic , readonly , strong ) GTReference *reference;
5153
5254+ (NSString *)localNamePrefix ;
5355+ (NSString *)remoteNamePrefix ;
5456
55- - (id )initWithReference : (GTReference *)ref repository : (GTRepository *)repo NS_DESIGNATED_INITIALIZER;
56- + (id )branchWithReference : (GTReference *)ref repository : (GTRepository *)repo ;
57+ // / Designated initializer.
58+ // /
59+ // / ref - The branch reference to wrap. Must not be nil.
60+ // / repo - The repository containing the branch. Must not be nil.
61+ // /
62+ // / Returns the initialized receiver.
63+ - (nullable instancetype )initWithReference : (GTReference *)ref repository : (GTRepository *)repo NS_DESIGNATED_INITIALIZER;
64+
65+ // / Convenience class initializer.
66+ // /
67+ // / ref - The branch reference to wrap. Must not be nil.
68+ // / repo - The repository containing the branch. Must not be nil.
69+ // /
70+ // / Returns an initialized instance.
71+ + (nullable instancetype )branchWithReference : (GTReference *)ref repository : (GTRepository *)repo ;
5772
5873// / Get the target commit for this branch
5974// /
6075// / error(out) - will be filled if an error occurs
6176// /
6277// / returns a GTCommit object or nil if an error occurred
63- - (GTCommit *)targetCommitAndReturnError : (NSError **)error ;
78+ - (nullable GTCommit *)targetCommitAndReturnError : (NSError **)error ;
6479
6580// / Count all commits in this branch
6681// /
@@ -69,15 +84,21 @@ typedef NS_ENUM(NSInteger, GTBranchType) {
6984// / returns number of commits in the branch or NSNotFound if an error occurred
7085- (NSUInteger )numberOfCommitsWithError : (NSError **)error ;
7186
72- - (NSArray *)uniqueCommitsRelativeToBranch : (GTBranch *)otherBranch error : (NSError **)error ;
87+ // / Get unique commits
88+ // /
89+ // / otherBranch -
90+ // / error - If not NULL, set to any error that occurs.
91+ // /
92+ // / Returns a (possibly empty) array of GTCommits, or nil if an error occurs.
93+ - (nullable NSArray *)uniqueCommitsRelativeToBranch : (GTBranch *)otherBranch error : (NSError **)error ;
7394
7495// / Deletes the local branch and nils out the reference.
7596- (BOOL )deleteWithError : (NSError **)error ;
7697
7798// / If the receiver is a local branch, looks up and returns its tracking branch.
7899// / If the receiver is a remote branch, returns self. If no tracking branch was
79100// / found, returns nil and sets `success` to YES.
80- - (GTBranch *)trackingBranchWithError : (NSError **)error success : (BOOL *)success ;
101+ - (nullable GTBranch *)trackingBranchWithError : (NSError **)error success : (nullable BOOL *)success ;
81102
82103// / Update the tracking branch.
83104// /
@@ -86,7 +107,7 @@ typedef NS_ENUM(NSInteger, GTBranchType) {
86107// / error - The error if one occurred.
87108// /
88109// / Returns whether it was successful.
89- - (BOOL )updateTrackingBranch : (GTBranch *)trackingBranch error : (NSError **)error ;
110+ - (BOOL )updateTrackingBranch : (nullable GTBranch *)trackingBranch error : (NSError **)error ;
90111
91112// / Reloads the branch's reference and creates a new branch based off that newly
92113// / loaded reference.
@@ -96,7 +117,7 @@ typedef NS_ENUM(NSInteger, GTBranchType) {
96117// / error - The error if one occurred.
97118// /
98119// / Returns the reloaded branch, or nil if an error occurred.
99- - (GTBranch *)reloadedBranchWithError : (NSError **)error ;
120+ - (nullable GTBranch *)reloadedBranchWithError : (NSError **)error ;
100121
101122// / Calculate the ahead/behind count from this branch to the given branch.
102123// /
@@ -110,3 +131,5 @@ typedef NS_ENUM(NSInteger, GTBranchType) {
110131- (BOOL )calculateAhead : (size_t *)ahead behind : (size_t *)behind relativeTo : (GTBranch *)branch error : (NSError **)error ;
111132
112133@end
134+
135+ NS_ASSUME_NONNULL_END
0 commit comments