Skip to content

Commit 4b6574b

Browse files
author
Ben Chatelain
committed
GTSubmodule nullability
1 parent a041bfa commit 4b6574b

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

ObjectiveGit/GTSubmodule.h

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ typedef NS_OPTIONS(NSInteger, GTSubmoduleStatus) {
5151
GTSubmoduleStatusUntrackedFilesInWorkingDirectory = GIT_SUBMODULE_STATUS_WD_UNTRACKED
5252
};
5353

54+
NS_ASSUME_NONNULL_BEGIN
55+
5456
/// Represents a submodule within its parent repository.
5557
@interface GTSubmodule : NSObject
5658

@@ -65,28 +67,28 @@ typedef NS_OPTIONS(NSInteger, GTSubmoduleStatus) {
6567
/// The OID that the submodule is pinned to in the parent repository's index.
6668
///
6769
/// If the submodule is not in the index, this will be nil.
68-
@property (nonatomic, strong, readonly) GTOID *indexOID;
70+
@property (nonatomic, strong, readonly, nullable) GTOID *indexOID;
6971

7072
/// The OID that the submodule is pinned to in the parent repository's HEAD
7173
/// commit.
7274
///
7375
/// If the submodule is not in HEAD, this will be nil.
74-
@property (nonatomic, strong, readonly) GTOID *HEADOID;
76+
@property (nonatomic, strong, readonly, nullable) GTOID *HEADOID;
7577

7678
/// The OID that is checked out in the submodule repository.
7779
///
7880
/// If the submodule is not checked out, this will be nil.
79-
@property (nonatomic, strong, readonly) GTOID *workingDirectoryOID;
81+
@property (nonatomic, strong, readonly, nullable) GTOID *workingDirectoryOID;
8082

8183
/// The name of this submodule.
82-
@property (nonatomic, copy, readonly) NSString *name;
84+
@property (nonatomic, copy, readonly, nullable) NSString *name;
8385

8486
/// The path to this submodule, relative to its parent repository's root.
85-
@property (nonatomic, copy, readonly) NSString *path;
87+
@property (nonatomic, copy, readonly, nullable) NSString *path;
8688

8789
/// The remote URL provided for this submodule, read from the parent repository's
8890
/// `.git/config` or `.gitmodules` file.
89-
@property (nonatomic, copy, readonly) NSString *URLString;
91+
@property (nonatomic, copy, readonly, nullable) NSString *URLString;
9092

9193
/// Initializes the receiver to wrap the given submodule object. Designated initializer.
9294
///
@@ -97,7 +99,7 @@ typedef NS_OPTIONS(NSInteger, GTSubmoduleStatus) {
9799
/// nil.
98100
///
99101
/// Returns an initialized GTSubmodule, or nil if an error occurs.
100-
- (id)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER;
102+
- (nullable instancetype)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository NS_DESIGNATED_INITIALIZER;
101103

102104
/// The underlying `git_submodule` object.
103105
- (git_submodule *)git_submodule __attribute__((objc_returns_inner_pointer));
@@ -120,7 +122,7 @@ typedef NS_OPTIONS(NSInteger, GTSubmoduleStatus) {
120122
/// If the submodule is not currently checked out, this will fail.
121123
///
122124
/// Returns the opened repository, or nil if an error occurs.
123-
- (GTRepository *)submoduleRepository:(NSError **)error;
125+
- (nullable GTRepository *)submoduleRepository:(NSError **)error;
124126

125127
/// Determines the status for the submodule.
126128
///
@@ -148,3 +150,5 @@ typedef NS_OPTIONS(NSInteger, GTSubmoduleStatus) {
148150
- (BOOL)addToIndex:(NSError **)error;
149151

150152
@end
153+
154+
NS_ASSUME_NONNULL_END

ObjectiveGit/GTSubmodule.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ - (void)dealloc {
7979
}
8080
}
8181

82-
- (id)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository {
82+
- (instancetype)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository {
8383
NSParameterAssert(submodule != NULL);
8484
NSParameterAssert(repository != nil);
8585

0 commit comments

Comments
 (0)