diff --git a/ObjectiveGit/GTBlame.h b/ObjectiveGit/GTBlame.h index 82454e6ec..e5bd396de 100644 --- a/ObjectiveGit/GTBlame.h +++ b/ObjectiveGit/GTBlame.h @@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN /// A `GTBlame` provides authorship info, through `GTBlameHunk` for each line of a file. Analogous to `git_blame` in libgit2. @interface GTBlame : NSObject +- (instancetype)init NS_UNAVAILABLE; + /// Designated initializer. /// /// blame - A git_blame to wrap. May not be NULL. diff --git a/ObjectiveGit/GTBlame.m b/ObjectiveGit/GTBlame.m index c2dcb5e9a..c1dee263f 100644 --- a/ObjectiveGit/GTBlame.m +++ b/ObjectiveGit/GTBlame.m @@ -21,6 +21,11 @@ @interface GTBlame () @implementation GTBlame +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitBlame:(git_blame *)blame { NSParameterAssert(blame != NULL); diff --git a/ObjectiveGit/GTBlameHunk.h b/ObjectiveGit/GTBlameHunk.h index d45fa3845..9e16c7850 100644 --- a/ObjectiveGit/GTBlameHunk.h +++ b/ObjectiveGit/GTBlameHunk.h @@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN /// A `GTBlameHunk` is an object that provides authorship info for a set of lines in a `GTBlame`. @interface GTBlameHunk : NSObject +- (instancetype)init NS_UNAVAILABLE; + /// Designated initializer. /// /// hunk - A git_blame_hunk to wrap. May not be NULL. diff --git a/ObjectiveGit/GTBlameHunk.m b/ObjectiveGit/GTBlameHunk.m index 4fc016c99..3be7dd4da 100644 --- a/ObjectiveGit/GTBlameHunk.m +++ b/ObjectiveGit/GTBlameHunk.m @@ -12,6 +12,11 @@ @implementation GTBlameHunk +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitBlameHunk:(git_blame_hunk)hunk { self = [super init]; if (self == nil) return nil; diff --git a/ObjectiveGit/GTBranch.h b/ObjectiveGit/GTBranch.h index 7c0930743..381b7c6a9 100644 --- a/ObjectiveGit/GTBranch.h +++ b/ObjectiveGit/GTBranch.h @@ -54,6 +54,8 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)localNamePrefix; + (NSString *)remoteNamePrefix; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initializer. /// /// ref - The branch reference to wrap. Must not be nil. diff --git a/ObjectiveGit/GTBranch.m b/ObjectiveGit/GTBranch.m index 8a4da3950..af7bfa117 100644 --- a/ObjectiveGit/GTBranch.m +++ b/ObjectiveGit/GTBranch.m @@ -69,6 +69,11 @@ + (nullable instancetype)branchWithReference:(GTReference *)ref repository:(GTRe return [[self alloc] initWithReference:ref repository:repo]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (nullable instancetype)initWithReference:(GTReference *)ref repository:(GTRepository *)repo { NSParameterAssert(ref != nil); NSParameterAssert(repo != nil); diff --git a/ObjectiveGit/GTConfiguration.h b/ObjectiveGit/GTConfiguration.h index b2bf9af2f..f9346fe63 100644 --- a/ObjectiveGit/GTConfiguration.h +++ b/ObjectiveGit/GTConfiguration.h @@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN /// repository, this will always be nil. @property (nonatomic, readonly, copy, nullable) NSArray *remotes; +- (instancetype)init NS_UNAVAILABLE; + /// Creates and returns a configuration which includes the global, XDG, and /// system configurations. + (nullable instancetype)defaultConfiguration; diff --git a/ObjectiveGit/GTConfiguration.m b/ObjectiveGit/GTConfiguration.m index 9ba160ef6..817f7a4e4 100644 --- a/ObjectiveGit/GTConfiguration.m +++ b/ObjectiveGit/GTConfiguration.m @@ -33,6 +33,11 @@ - (void)dealloc { } } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitConfig:(git_config *)config repository:(GTRepository *)repository { NSParameterAssert(config != NULL); diff --git a/ObjectiveGit/GTDiff.h b/ObjectiveGit/GTDiff.h index fd78c28f1..e2ba2cef9 100644 --- a/ObjectiveGit/GTDiff.h +++ b/ObjectiveGit/GTDiff.h @@ -259,6 +259,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns a newly created GTDiff, or nil if an error occurred. + (nullable instancetype)diffWorkingDirectoryToHEADInRepository:(GTRepository *)repository options:(nullable NSDictionary *)options error:(NSError **)error; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initialiser. /// /// diff - The diff to represent. Cannot be NULL. diff --git a/ObjectiveGit/GTDiff.m b/ObjectiveGit/GTDiff.m index 15ae44143..75e76377e 100644 --- a/ObjectiveGit/GTDiff.m +++ b/ObjectiveGit/GTDiff.m @@ -156,6 +156,11 @@ + (instancetype)diffWorkingDirectoryToHEADInRepository:(GTRepository *)repositor return HEADIndexDiff; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitDiff:(git_diff *)diff repository:(GTRepository *)repository { NSParameterAssert(diff != NULL); NSParameterAssert(repository != nil); diff --git a/ObjectiveGit/GTDiffDelta.h b/ObjectiveGit/GTDiffDelta.h index 589d4e0a2..49d9d0a7d 100644 --- a/ObjectiveGit/GTDiffDelta.h +++ b/ObjectiveGit/GTDiffDelta.h @@ -115,6 +115,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns a diff delta, or nil if an error occurs. + (nullable instancetype)diffDeltaFromData:(nullable NSData *)oldData forPath:(nullable NSString *)oldDataPath toData:(nullable NSData *)newData forPath:(nullable NSString *)newDataPath options:(nullable NSDictionary *)options error:(NSError **)error; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver to wrap the delta at the given index. /// /// diff - The diff which contains the delta to wrap. Must not be nil. diff --git a/ObjectiveGit/GTDiffDelta.m b/ObjectiveGit/GTDiffDelta.m index 565cb9975..952222dee 100644 --- a/ObjectiveGit/GTDiffDelta.m +++ b/ObjectiveGit/GTDiffDelta.m @@ -132,6 +132,11 @@ + (instancetype)diffDeltaFromData:(NSData *)oldData forPath:(NSString *)oldDataP }]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithDiff:(GTDiff *)diff deltaIndex:(NSUInteger)deltaIndex { NSCParameterAssert(diff != nil); diff --git a/ObjectiveGit/GTDiffFile.h b/ObjectiveGit/GTDiffFile.h index bf3f8bb8f..5f277ff28 100644 --- a/ObjectiveGit/GTDiffFile.h +++ b/ObjectiveGit/GTDiffFile.h @@ -48,6 +48,8 @@ NS_ASSUME_NONNULL_BEGIN /// The git_diff_file represented by the receiver. @property (nonatomic, readonly) git_diff_file git_diff_file; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver with the provided libgit2 object. Designated initializer. /// /// file - The git_diff_file wrapped by the receiver. diff --git a/ObjectiveGit/GTDiffFile.m b/ObjectiveGit/GTDiffFile.m index 1478b6cbe..135f758a0 100644 --- a/ObjectiveGit/GTDiffFile.m +++ b/ObjectiveGit/GTDiffFile.m @@ -11,6 +11,11 @@ @implementation GTDiffFile +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitDiffFile:(git_diff_file)file { NSParameterAssert(file.path != NULL); diff --git a/ObjectiveGit/GTDiffHunk.h b/ObjectiveGit/GTDiffHunk.h index 13fe88d9a..bb9a16d6c 100644 --- a/ObjectiveGit/GTDiffHunk.h +++ b/ObjectiveGit/GTDiffHunk.h @@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN /// The number of lines represented in the hunk. @property (nonatomic, readonly) NSUInteger lineCount; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initialiser. /// /// The contents of a hunk are lazily loaded, therefore we initialise the object diff --git a/ObjectiveGit/GTDiffHunk.m b/ObjectiveGit/GTDiffHunk.m index 51cabae78..d5174dcbc 100644 --- a/ObjectiveGit/GTDiffHunk.m +++ b/ObjectiveGit/GTDiffHunk.m @@ -25,6 +25,11 @@ @interface GTDiffHunk () @implementation GTDiffHunk +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithPatch:(GTDiffPatch *)patch hunkIndex:(NSUInteger)hunkIndex { NSParameterAssert(patch != nil); diff --git a/ObjectiveGit/GTDiffLine.h b/ObjectiveGit/GTDiffLine.h index 926dce2ee..bb54d2234 100644 --- a/ObjectiveGit/GTDiffLine.h +++ b/ObjectiveGit/GTDiffLine.h @@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN /// The number of newlines appearing in `-content`. @property (nonatomic, readonly) NSInteger lineCount; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initialiser. /// /// line - The diff line to wrap. May not be NULL. diff --git a/ObjectiveGit/GTDiffLine.m b/ObjectiveGit/GTDiffLine.m index 36df18c6e..1d20211cd 100644 --- a/ObjectiveGit/GTDiffLine.m +++ b/ObjectiveGit/GTDiffLine.m @@ -10,6 +10,11 @@ @implementation GTDiffLine +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitLine:(const git_diff_line *)line { self = [super init]; if (self == nil) return nil; diff --git a/ObjectiveGit/GTDiffPatch.h b/ObjectiveGit/GTDiffPatch.h index 7e06b31b7..86971a6f0 100644 --- a/ObjectiveGit/GTDiffPatch.h +++ b/ObjectiveGit/GTDiffPatch.h @@ -32,6 +32,8 @@ NS_ASSUME_NONNULL_BEGIN /// The number of hunks in this patch. @property (nonatomic, readonly) NSUInteger hunkCount; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver to wrap the given patch. Designated initializer. /// /// patch - The patch object to wrap and take ownership of. This will diff --git a/ObjectiveGit/GTDiffPatch.m b/ObjectiveGit/GTDiffPatch.m index 6826d80a2..fe28d662a 100644 --- a/ObjectiveGit/GTDiffPatch.m +++ b/ObjectiveGit/GTDiffPatch.m @@ -20,6 +20,11 @@ @implementation GTDiffPatch #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitPatch:(git_patch *)patch delta:(GTDiffDelta *)delta { NSParameterAssert(patch != NULL); NSParameterAssert(delta != nil); diff --git a/ObjectiveGit/GTEnumerator.h b/ObjectiveGit/GTEnumerator.h index 2e175b516..aee9b3af2 100644 --- a/ObjectiveGit/GTEnumerator.h +++ b/ObjectiveGit/GTEnumerator.h @@ -62,6 +62,8 @@ NS_ASSUME_NONNULL_BEGIN /// To set new options, use -resetWithOptions:. @property (nonatomic, assign, readonly) GTEnumeratorOptions options; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver to enumerate the commits in the given repository. Designated initializer. /// /// repo - The repository to enumerate the commits of. This must not be nil. diff --git a/ObjectiveGit/GTEnumerator.m b/ObjectiveGit/GTEnumerator.m index f5dd5b0c8..673d7f8c6 100644 --- a/ObjectiveGit/GTEnumerator.m +++ b/ObjectiveGit/GTEnumerator.m @@ -48,6 +48,11 @@ @implementation GTEnumerator #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithRepository:(GTRepository *)repo error:(NSError **)error { NSParameterAssert(repo != nil); diff --git a/ObjectiveGit/GTFetchHeadEntry.h b/ObjectiveGit/GTFetchHeadEntry.h index 5c8af0ea0..20b2b9a2f 100644 --- a/ObjectiveGit/GTFetchHeadEntry.h +++ b/ObjectiveGit/GTFetchHeadEntry.h @@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN /// Flag indicating if we need to merge this entry or not. @property (nonatomic, getter = isMerge, readonly) BOOL merge; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes a GTFetchHeadEntry. Designated initializer. /// /// reference - Reference on the repository. Cannot be nil. diff --git a/ObjectiveGit/GTFetchHeadEntry.m b/ObjectiveGit/GTFetchHeadEntry.m index 04a75c28a..ac8e1d235 100644 --- a/ObjectiveGit/GTFetchHeadEntry.m +++ b/ObjectiveGit/GTFetchHeadEntry.m @@ -11,6 +11,11 @@ @implementation GTFetchHeadEntry +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithReference:(GTReference *)reference remoteURLString:(NSString *)remoteURLString targetOID:(GTOID *)targetOID isMerge:(BOOL)merge { NSParameterAssert(reference != nil); NSParameterAssert(remoteURLString != nil); diff --git a/ObjectiveGit/GTFilter.h b/ObjectiveGit/GTFilter.h index c08aa2334..2823300f1 100644 --- a/ObjectiveGit/GTFilter.h +++ b/ObjectiveGit/GTFilter.h @@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN /// chance to clean up the `payload`. @property (nonatomic, copy) void (^cleanupBlock)(void *payload); +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the object with the given name and attributes. Designated initializer. /// /// name - The name for the filter. Cannot be nil. diff --git a/ObjectiveGit/GTFilter.m b/ObjectiveGit/GTFilter.m index 4914f811a..7788c08d7 100644 --- a/ObjectiveGit/GTFilter.m +++ b/ObjectiveGit/GTFilter.m @@ -42,6 +42,11 @@ + (void)initialize { GTFiltersGitFilterToRegisteredFilters = [[NSMutableDictionary alloc] init]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithName:(NSString *)name attributes:(NSString *)attributes applyBlock:(NSData * (^)(void **payload, NSData *from, GTFilterSource *source, BOOL *applied))applyBlock { NSParameterAssert(name != nil); NSParameterAssert(applyBlock != NULL); diff --git a/ObjectiveGit/GTFilterList.h b/ObjectiveGit/GTFilterList.h index 15ab9ec82..7b45f4b70 100644 --- a/ObjectiveGit/GTFilterList.h +++ b/ObjectiveGit/GTFilterList.h @@ -23,6 +23,8 @@ NS_ASSUME_NONNULL_BEGIN /// An opaque list of filters that apply to a given path. @interface GTFilterList : NSObject +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver to wrap the given `git_filter_list`. Designated initializer. /// /// filterList - The filter list to wrap and take ownership of. This filter list diff --git a/ObjectiveGit/GTFilterList.m b/ObjectiveGit/GTFilterList.m index 0f47a88d4..1780293a4 100644 --- a/ObjectiveGit/GTFilterList.m +++ b/ObjectiveGit/GTFilterList.m @@ -25,6 +25,11 @@ @implementation GTFilterList #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitFilterList:(git_filter_list *)filterList { NSParameterAssert(filterList != NULL); diff --git a/ObjectiveGit/GTFilterSource.h b/ObjectiveGit/GTFilterSource.h index 6c9d4ee20..e7d60c2cc 100644 --- a/ObjectiveGit/GTFilterSource.h +++ b/ObjectiveGit/GTFilterSource.h @@ -40,6 +40,8 @@ NS_ASSUME_NONNULL_BEGIN /// The filter mode. @property (nonatomic, readonly, assign) GTFilterSourceMode mode; +- (instancetype)init NS_UNAVAILABLE; + /// Intializes the receiver with the given filter source. Designated initializer. /// /// source - The filter source. Cannot be NULL. diff --git a/ObjectiveGit/GTFilterSource.m b/ObjectiveGit/GTFilterSource.m index 0c686cdc7..91de241b3 100644 --- a/ObjectiveGit/GTFilterSource.m +++ b/ObjectiveGit/GTFilterSource.m @@ -16,6 +16,11 @@ @implementation GTFilterSource #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitFilterSource:(const git_filter_source *)source { NSParameterAssert(source != NULL); diff --git a/ObjectiveGit/GTIndex.h b/ObjectiveGit/GTIndex.h index f656b8b9e..2c226f87a 100644 --- a/ObjectiveGit/GTIndex.h +++ b/ObjectiveGit/GTIndex.h @@ -71,6 +71,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns the loaded index, or nil if an error occurred. + (instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver with the given libgit2 index. Designated initializer. /// /// index - The libgit2 index from which the index should be created. Cannot diff --git a/ObjectiveGit/GTIndex.m b/ObjectiveGit/GTIndex.m index 330cc6b0d..863beb9cc 100644 --- a/ObjectiveGit/GTIndex.m +++ b/ObjectiveGit/GTIndex.m @@ -87,6 +87,11 @@ + (instancetype)inMemoryIndexWithRepository:(GTRepository *)repository error:(NS return [[self alloc] initWithGitIndex:index repository:repository]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + + (instancetype)indexWithFileURL:(NSURL *)fileURL repository:(GTRepository *)repository error:(NSError **)error { NSParameterAssert(fileURL != nil); NSParameterAssert(fileURL.isFileURL); diff --git a/ObjectiveGit/GTIndexEntry.h b/ObjectiveGit/GTIndexEntry.h index 82574be39..194b7d487 100644 --- a/ObjectiveGit/GTIndexEntry.h +++ b/ObjectiveGit/GTIndexEntry.h @@ -45,6 +45,8 @@ NS_ASSUME_NONNULL_BEGIN @interface GTIndexEntry : NSObject +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver with the given libgit2 index entry. /// /// entry - The libgit2 index entry. Cannot be NULL. diff --git a/ObjectiveGit/GTIndexEntry.m b/ObjectiveGit/GTIndexEntry.m index 8a6971c70..3cd401aff 100644 --- a/ObjectiveGit/GTIndexEntry.m +++ b/ObjectiveGit/GTIndexEntry.m @@ -50,6 +50,11 @@ - (NSString *)description { #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitIndexEntry:(const git_index_entry *)entry index:(GTIndex *)index error:(NSError **)error { NSParameterAssert(entry != NULL); diff --git a/ObjectiveGit/GTOID.h b/ObjectiveGit/GTOID.h index b3618b943..93ead4539 100644 --- a/ObjectiveGit/GTOID.h +++ b/ObjectiveGit/GTOID.h @@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN /// inserted into the ODB yet. @property (nonatomic, readonly, assign, getter = isZero) BOOL zero; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver with the given git_oid. Designated initializer. /// /// git_oid - The underlying git_oid. Cannot be NULL. diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index f5d158169..6cf387171 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -39,6 +39,11 @@ - (NSString *)SHA { #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitOid:(const git_oid *)oid { NSParameterAssert(oid != NULL); diff --git a/ObjectiveGit/GTObject.h b/ObjectiveGit/GTObject.h index d16037e9f..c39abd37b 100644 --- a/ObjectiveGit/GTObject.h +++ b/ObjectiveGit/GTObject.h @@ -57,6 +57,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTRepository *repository; @property (nonatomic, readonly, nullable) GTOID *OID; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initializer. - (nullable id)initWithObj:(git_object *)theObject inRepository:(GTRepository *)theRepo NS_DESIGNATED_INITIALIZER; diff --git a/ObjectiveGit/GTObject.m b/ObjectiveGit/GTObject.m index aa3eab5bc..43dcbe396 100644 --- a/ObjectiveGit/GTObject.m +++ b/ObjectiveGit/GTObject.m @@ -70,6 +70,11 @@ - (BOOL)isEqual:(id)otherObject { #pragma mark API +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (id)initWithObj:(git_object *)object inRepository:(GTRepository *)repo { NSParameterAssert(object != NULL); NSParameterAssert(repo != nil); diff --git a/ObjectiveGit/GTObjectDatabase.h b/ObjectiveGit/GTObjectDatabase.h index c8d975c7b..14cad11d5 100644 --- a/ObjectiveGit/GTObjectDatabase.h +++ b/ObjectiveGit/GTObjectDatabase.h @@ -33,6 +33,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly, strong) GTRepository *repository; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the object database with the given repository. Designated initializer. /// /// repo - The repository from which the object database should be created. diff --git a/ObjectiveGit/GTObjectDatabase.m b/ObjectiveGit/GTObjectDatabase.m index 242f06655..534df08da 100644 --- a/ObjectiveGit/GTObjectDatabase.m +++ b/ObjectiveGit/GTObjectDatabase.m @@ -56,6 +56,11 @@ - (void)dealloc { #pragma mark API +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithRepository:(GTRepository *)repo error:(NSError **)error { NSParameterAssert(repo != nil); diff --git a/ObjectiveGit/GTOdbObject.h b/ObjectiveGit/GTOdbObject.h index 469a862f3..8add7d39f 100644 --- a/ObjectiveGit/GTOdbObject.h +++ b/ObjectiveGit/GTOdbObject.h @@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN /// The repository in which the object resides. @property (nonatomic, readonly, strong) GTRepository *repository; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the object with the underlying libgit2 object and repository. Designated initializer. /// /// object - The underlying libgit2 object. Cannot be NULL. diff --git a/ObjectiveGit/GTOdbObject.m b/ObjectiveGit/GTOdbObject.m index 3aedfd5bb..09c13b7ea 100644 --- a/ObjectiveGit/GTOdbObject.m +++ b/ObjectiveGit/GTOdbObject.m @@ -31,6 +31,11 @@ - (NSString *)description { #pragma mark API +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithOdbObj:(git_odb_object *)object repository:(GTRepository *)repository { NSParameterAssert(object != NULL); NSParameterAssert(repository != nil); diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index b502bfb82..5109e7d99 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -64,6 +64,8 @@ NS_ASSUME_NONNULL_BEGIN + (nullable instancetype)referenceByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error; - (nullable instancetype)initByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initializer. /// /// ref - The reference to wrap. Must not be nil. diff --git a/ObjectiveGit/GTReference.m b/ObjectiveGit/GTReference.m index a9e93cb0b..63c63836d 100644 --- a/ObjectiveGit/GTReference.m +++ b/ObjectiveGit/GTReference.m @@ -74,6 +74,11 @@ + (instancetype)referenceByResolvingSymbolicReference:(GTReference *)symbolicRef return [[self alloc] initByResolvingSymbolicReference:symbolicRef error:error]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initByResolvingSymbolicReference:(GTReference *)symbolicRef error:(NSError **)error { NSParameterAssert(symbolicRef != nil); diff --git a/ObjectiveGit/GTReflog+Private.h b/ObjectiveGit/GTReflog+Private.h index fa59d1290..9fc78e8b8 100644 --- a/ObjectiveGit/GTReflog+Private.h +++ b/ObjectiveGit/GTReflog+Private.h @@ -12,6 +12,8 @@ @interface GTReflog () +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver with a reference. Designated initializer. /// /// reference - The reference whose reflog is being represented. Cannot be nil. diff --git a/ObjectiveGit/GTReflog.m b/ObjectiveGit/GTReflog.m index 6ea1b4d02..be1ecad6b 100644 --- a/ObjectiveGit/GTReflog.m +++ b/ObjectiveGit/GTReflog.m @@ -33,6 +33,11 @@ - (void)dealloc { if (_git_reflog != NULL) git_reflog_free(_git_reflog); } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithReference:(GTReference *)reference { NSParameterAssert(reference != nil); NSParameterAssert(reference.name != nil); diff --git a/ObjectiveGit/GTRemote.h b/ObjectiveGit/GTRemote.h index c470f81ac..74f6af24c 100644 --- a/ObjectiveGit/GTRemote.h +++ b/ObjectiveGit/GTRemote.h @@ -86,6 +86,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns the loaded remote, or nil if an error occurred. + (nullable instancetype)remoteWithName:(NSString *)name inRepository:(GTRepository *)repo error:(NSError **)error; +- (instancetype)init NS_UNAVAILABLE; + /// Initialize a remote from a `git_remote`. Designated initializer. /// /// remote - The underlying `git_remote` object. Cannot be nil. diff --git a/ObjectiveGit/GTRemote.m b/ObjectiveGit/GTRemote.m index ca91f8895..56c97199f 100644 --- a/ObjectiveGit/GTRemote.m +++ b/ObjectiveGit/GTRemote.m @@ -60,6 +60,11 @@ + (instancetype)remoteWithName:(NSString *)name inRepository:(GTRepository *)rep return [[self alloc] initWithGitRemote:remote inRepository:repo]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitRemote:(git_remote *)remote inRepository:(GTRepository *)repo { NSParameterAssert(remote != NULL); NSParameterAssert(repo != nil); diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index de072a046..dfbecbbea 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -195,6 +195,8 @@ NS_ASSUME_NONNULL_BEGIN /// Returns the initialized repository, or nil if an error occurred. - (nullable instancetype)initWithURL:(NSURL *)localFileURL error:(NSError **)error; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver to wrap the given repository object. Designated initializer. /// /// repository - The repository to wrap. The receiver will take over memory diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index c08827420..12eb3a315 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -157,6 +157,11 @@ + (instancetype)repositoryWithURL:(NSURL *)localFileURL error:(NSError **)error return [[self alloc] initWithURL:localFileURL error:error]; } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitRepository:(git_repository *)repository { NSParameterAssert(repository != nil); diff --git a/ObjectiveGit/GTStatusDelta.h b/ObjectiveGit/GTStatusDelta.h index b399d7cb1..24bea36ba 100644 --- a/ObjectiveGit/GTStatusDelta.h +++ b/ObjectiveGit/GTStatusDelta.h @@ -47,6 +47,8 @@ NS_ASSUME_NONNULL_BEGIN /// `GTStatusDeltaStatusCopied`. @property (nonatomic, readonly) double similarity; +- (instancetype)init NS_UNAVAILABLE; + /// Designated initializer. - (nullable instancetype)initWithGitDiffDelta:(const git_diff_delta *)delta NS_DESIGNATED_INITIALIZER; diff --git a/ObjectiveGit/GTStatusDelta.m b/ObjectiveGit/GTStatusDelta.m index 230691451..04b80b7fe 100644 --- a/ObjectiveGit/GTStatusDelta.m +++ b/ObjectiveGit/GTStatusDelta.m @@ -12,6 +12,11 @@ @implementation GTStatusDelta +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitDiffDelta:(const git_diff_delta *)delta { self = [super init]; if (self == nil || delta == NULL) return nil; diff --git a/ObjectiveGit/GTSubmodule.h b/ObjectiveGit/GTSubmodule.h index 81d2e0a25..43d77812f 100644 --- a/ObjectiveGit/GTSubmodule.h +++ b/ObjectiveGit/GTSubmodule.h @@ -90,6 +90,8 @@ NS_ASSUME_NONNULL_BEGIN /// `.git/config` or `.gitmodules` file. @property (nonatomic, copy, readonly, nullable) NSString *URLString; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver to wrap the given submodule object. Designated initializer. /// /// submodule - The submodule to wrap. The receiver will not own this object, so diff --git a/ObjectiveGit/GTSubmodule.m b/ObjectiveGit/GTSubmodule.m index b6b8c5eee..2d6ab1c4e 100644 --- a/ObjectiveGit/GTSubmodule.m +++ b/ObjectiveGit/GTSubmodule.m @@ -83,6 +83,11 @@ - (void)dealloc { } } +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithGitSubmodule:(git_submodule *)submodule parentRepository:(GTRepository *)repository { NSParameterAssert(submodule != NULL); NSParameterAssert(repository != nil); diff --git a/ObjectiveGit/GTTreeBuilder.h b/ObjectiveGit/GTTreeBuilder.h index 83fb65072..9daefb9d6 100644 --- a/ObjectiveGit/GTTreeBuilder.h +++ b/ObjectiveGit/GTTreeBuilder.h @@ -54,6 +54,8 @@ NS_ASSUME_NONNULL_BEGIN /// Get the number of entries listed in a treebuilder. @property (nonatomic, readonly) NSUInteger entryCount; +- (instancetype)init NS_UNAVAILABLE; + /// Initializes the receiver, optionally from an existing tree. Designated initializer. /// /// treeOrNil - Source tree (or nil) diff --git a/ObjectiveGit/GTTreeBuilder.m b/ObjectiveGit/GTTreeBuilder.m index 773ba2da7..6aa5da7a4 100644 --- a/ObjectiveGit/GTTreeBuilder.m +++ b/ObjectiveGit/GTTreeBuilder.m @@ -62,6 +62,11 @@ - (NSUInteger)entryCount { #pragma mark Lifecycle +- (instancetype)init { + NSAssert(NO, @"Call to an unavailable initializer."); + return nil; +} + - (instancetype)initWithTree:(GTTree *)treeOrNil repository:(GTRepository *)repository error:(NSError **)error { NSParameterAssert(repository != nil);