|
12 | 12 | @class GTBlameHunk; |
13 | 13 | @class GTRepository; |
14 | 14 |
|
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. |
16 | 18 | @interface GTBlame : NSObject |
17 | 19 |
|
18 | 20 | /// 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; |
20 | 26 |
|
21 | 27 | /// Get all the hunks in the blame. A convenience wrapper around `enumerateHunksUsingBlock:` |
22 | 28 | @property (nonatomic, strong, readonly) NSArray *hunks; |
|
29 | 35 | /// index - The index to retrieve the hunk from. |
30 | 36 | /// |
31 | 37 | /// Returns a `GTBlameHunk` or nil if an error occurred. |
32 | | -- (GTBlameHunk *)hunkAtIndex:(NSUInteger)index; |
| 38 | +- (nullable GTBlameHunk *)hunkAtIndex:(NSUInteger)index; |
33 | 39 |
|
34 | 40 | /// Enumerate the hunks in the blame. |
35 | 41 | /// |
36 | 42 | /// block - A block invoked for every hunk in the blame. |
37 | 43 | /// Setting stop to `YES` instantly stops the enumeration. |
| 44 | +/// May not be NULL. |
38 | 45 | /// |
39 | 46 | - (void)enumerateHunksUsingBlock:(void (^)(GTBlameHunk *hunk, NSUInteger index, BOOL *stop))block; |
40 | 47 |
|
|
43 | 50 | /// lineNumber - The (1 based) line number to find a hunk for. |
44 | 51 | /// |
45 | 52 | /// Returns a `GTBlameHunk` or nil if an error occurred. |
46 | | -- (GTBlameHunk *)hunkAtLineNumber:(NSUInteger)lineNumber; |
| 53 | +- (nullable GTBlameHunk *)hunkAtLineNumber:(NSUInteger)lineNumber; |
47 | 54 |
|
48 | 55 | /// The underlying `git_blame` object. |
49 | 56 | - (git_blame *)git_blame __attribute__((objc_returns_inner_pointer)); |
50 | 57 |
|
51 | 58 | @end |
52 | 59 |
|
| 60 | +NS_ASSUME_NONNULL_END |
0 commit comments