Skip to content

Commit 2352543

Browse files
committed
Respect nullable returns in various methods
Some properties could return nil where they are not annotated as such.
1 parent 16ef587 commit 2352543

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

ObjectiveGit/GTCredential.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char
109109
return GIT_ERROR;
110110
}
111111

112-
NSString *URL = (url != NULL ? @(url) : nil);
112+
NSString *URL = (url != NULL ? @(url) : @"");
113113
NSString *userName = (username_from_url != NULL ? @(username_from_url) : nil);
114114

115115
GTCredential *cred = [provider credentialForType:(GTCredentialType)allowed_types URL:URL userName:userName];

ObjectiveGit/GTIndex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ NS_ASSUME_NONNULL_BEGIN
6969
/// error - If not NULL, set to any error that occurs.
7070
///
7171
/// Returns the loaded index, or nil if an error occurred.
72-
+ (instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error;
72+
+ (nullable instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error;
7373

7474
- (instancetype)init NS_UNAVAILABLE;
7575

ObjectiveGit/GTIndexEntry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ NS_ASSUME_NONNULL_BEGIN
6161
- (const git_index_entry *)git_index_entry __attribute__((objc_returns_inner_pointer));
6262

6363
/// The entry's index. This may be nil if nil is passed in to -initWithGitIndexEntry:
64-
@property (nonatomic, strong, readonly) GTIndex *index;
64+
@property (nonatomic, strong, readonly, nullable) GTIndex *index;
6565

6666
/// The repository-relative path for the entry.
6767
@property (nonatomic, readonly, copy) NSString *path;

ObjectiveGit/GTOID.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
1616
@interface GTOID : NSObject <NSCopying>
1717

1818
/// The SHA pointed to by the OID.
19-
@property (nonatomic, readonly, copy) NSString *SHA;
19+
@property (nonatomic, readonly, copy, nullable) NSString *SHA;
2020

2121
/// Is the OID all zero? This usually indicates that the object has not been
2222
/// inserted into the ODB yet.

ObjectiveGit/GTReference.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
5252
@property (nonatomic, readonly, strong) GTRepository *repository;
5353
@property (nonatomic, readonly) GTReferenceType referenceType;
5454
@property (nonatomic, readonly) const git_oid *git_oid;
55-
@property (nonatomic, strong, readonly) GTOID *OID;
55+
@property (nonatomic, strong, readonly, nullable) GTOID *OID;
5656

5757
/// Whether this is a remote-tracking branch.
5858
@property (nonatomic, readonly, getter = isRemote) BOOL remote;
@@ -78,10 +78,10 @@ NS_ASSUME_NONNULL_BEGIN
7878
- (git_reference *)git_reference __attribute__((objc_returns_inner_pointer));
7979

8080
/// The target (either GTObject or GTReference) to which the reference points.
81-
@property (nonatomic, readonly, copy) id unresolvedTarget;
81+
@property (nonatomic, readonly, copy, nullable) id unresolvedTarget;
8282

8383
/// The resolved object to which the reference points.
84-
@property (nonatomic, readonly, copy) id resolvedTarget;
84+
@property (nonatomic, readonly, copy, nullable) id resolvedTarget;
8585

8686
/// The last direct reference in a chain
8787
@property (nonatomic, readonly, copy) GTReference *resolvedReference;

ObjectiveGit/GTRepository.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ typedef NS_ENUM(NSInteger, GTRepositoryStateType) {
177177
@interface GTRepository : NSObject
178178

179179
/// The file URL for the repository's working directory.
180-
@property (nonatomic, readonly, strong) NSURL *fileURL;
180+
@property (nonatomic, readonly, strong, nullable) NSURL *fileURL;
181181
/// The file URL for the repository's .git directory.
182182
@property (nonatomic, readonly, strong, nullable) NSURL *gitDirectoryURL;
183183

ObjectiveGit/GTSignature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ NS_ASSUME_NONNULL_BEGIN
4242
@property (nonatomic, readonly, copy, nullable) NSString *email;
4343

4444
/// The time when the action happened.
45-
@property (nonatomic, readonly, strong) NSDate *time;
45+
@property (nonatomic, readonly, strong, nullable) NSDate *time;
4646

4747
/// The time zone that `time` should be interpreted relative to.
48-
@property (nonatomic, readonly, copy) NSTimeZone *timeZone;
48+
@property (nonatomic, readonly, copy, nullable) NSTimeZone *timeZone;
4949

5050
/// Initializes the receiver with the given signature.
5151
///

0 commit comments

Comments
 (0)