Skip to content

Commit f69ac1e

Browse files
author
Ben Chatelain
committed
GTBlame nullability
1 parent 0a5f6f4 commit f69ac1e

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

ObjectiveGit/GTBlame.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,17 @@
1212
@class GTBlameHunk;
1313
@class GTRepository;
1414

15-
/// A `GTBlame` provides authorship info, through `GTBlameHunk` for each line of a file.
15+
NS_ASSUME_NONNULL_BEGIN
16+
17+
/// A `GTBlame` provides authorship info, through `GTBlameHunk` for each line of a file. Analogous to `git_blame` in libgit2.
1618
@interface GTBlame : NSObject
1719

1820
/// Designated initializer.
19-
- (instancetype)initWithGitBlame:(git_blame *)blame NS_DESIGNATED_INITIALIZER;
21+
///
22+
/// blame - A git_blame to wrap. May not be NULL.
23+
///
24+
/// Returns a blame, or nil if initialization failed.
25+
- (nullable instancetype)initWithGitBlame:(git_blame *)blame NS_DESIGNATED_INITIALIZER;
2026

2127
/// Get all the hunks in the blame. A convenience wrapper around `enumerateHunksUsingBlock:`
2228
@property (nonatomic, strong, readonly) NSArray *hunks;
@@ -29,12 +35,13 @@
2935
/// index - The index to retrieve the hunk from.
3036
///
3137
/// Returns a `GTBlameHunk` or nil if an error occurred.
32-
- (GTBlameHunk *)hunkAtIndex:(NSUInteger)index;
38+
- (nullable GTBlameHunk *)hunkAtIndex:(NSUInteger)index;
3339

3440
/// Enumerate the hunks in the blame.
3541
///
3642
/// block - A block invoked for every hunk in the blame.
3743
/// Setting stop to `YES` instantly stops the enumeration.
44+
/// May not be NULL.
3845
///
3946
- (void)enumerateHunksUsingBlock:(void (^)(GTBlameHunk *hunk, NSUInteger index, BOOL *stop))block;
4047

@@ -43,10 +50,11 @@
4350
/// lineNumber - The (1 based) line number to find a hunk for.
4451
///
4552
/// Returns a `GTBlameHunk` or nil if an error occurred.
46-
- (GTBlameHunk *)hunkAtLineNumber:(NSUInteger)lineNumber;
53+
- (nullable GTBlameHunk *)hunkAtLineNumber:(NSUInteger)lineNumber;
4754

4855
/// The underlying `git_blame` object.
4956
- (git_blame *)git_blame __attribute__((objc_returns_inner_pointer));
5057

5158
@end
5259

60+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)