Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings & update dependencies #714

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion External/libgit2
Submodule libgit2 updated 1251 files
2 changes: 1 addition & 1 deletion External/libssh2
Submodule libssh2 updated 129 files
2 changes: 1 addition & 1 deletion External/openssl
Submodule openssl updated 19279 files
1 change: 0 additions & 1 deletion ObjectiveGit.modulemap
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ framework module ObjectiveGit {
header "git2/sys/refs.h"
header "git2/sys/repository.h"
header "git2/sys/transport.h"
header "git2/sys/time.h"
header "git2/cred_helpers.h"
header "git2/sys/openssl.h"
header "git2/sys/stream.h"
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/Categories/NSArray+StringArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import <Foundation/Foundation.h>
#import "git2/strarray.h"
#import <ObjectiveGit/git2/strarray.h>

@interface NSArray (StringArray)

Expand Down
6 changes: 3 additions & 3 deletions ObjectiveGit/Categories/NSData+Git.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
//

#import <Foundation/Foundation.h>
#import "git2/buffer.h"
#import "git2/oid.h"
#import <ObjectiveGit/git2/buffer.h>
#import <ObjectiveGit/git2/oid.h>

@interface NSData (Git)

+ (NSData *)git_dataWithOid:(git_oid *)oid;
- (BOOL)git_getOid:(git_oid *)oid error:(NSError **)error;
- (BOOL)git_getOid:(git_oid *)oid error:(NSError * __autoreleasing *)error;

/// Creates an NSData object that will take ownership of a libgit2 buffer.
///
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/Categories/NSData+Git.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ + (NSData *)git_dataWithOid:(git_oid *)oid {
return [NSData dataWithBytes:oid length:sizeof(git_oid)];
}

- (BOOL)git_getOid:(git_oid *)oid error:(NSError **)error {
- (BOOL)git_getOid:(git_oid *)oid error:(NSError * __autoreleasing *)error {
if ([self length] != sizeof(git_oid)) {
if (error != NULL) {
*error = [NSError errorWithDomain:GTGitErrorDomain
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/Categories/NSDate+GTTimeAdditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
//

#import <Foundation/Foundation.h>
#import "git2/types.h"
#import <ObjectiveGit/git2/types.h>

@interface NSDate (GTTimeAdditions)

Expand Down
14 changes: 7 additions & 7 deletions ObjectiveGit/GTBlob.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - Will be set if an error occurs. This may be nil.
///
/// Return a newly created blob object, or nil if an error occurs.
+ (instancetype _Nullable)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error;
+ (instancetype _Nullable)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error;

/// Creates a new blob from the given data.
///
Expand All @@ -54,7 +54,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - Will be set if an error occurs. This may be nil.
///
/// Return a newly created blob object, or nil if an error occurs.
+ (instancetype _Nullable)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
+ (instancetype _Nullable)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error;

/// Creates a new blob given an NSURL to a file.
///
Expand All @@ -65,7 +65,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - Will be set if an error occurs. This may be nil.
///
/// Return a newly created blob object, or nil if an error occurs.
+ (instancetype _Nullable)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
+ (instancetype _Nullable)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error;

/// Creates a new blob from the given string.
///
Expand All @@ -76,7 +76,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - Will be set if an error occurs. This may be nil.
///
/// Return a newly created blob object, or nil if an error occurs.
- (instancetype _Nullable)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error;
- (instancetype _Nullable)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error;

/// Creates a new blob from the passed data.
///
Expand All @@ -87,7 +87,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - Will be set if an error occurs. This may be nil.
///
/// Returns a newly created blob object, or nil if an error occurs.
- (instancetype _Nullable)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error;
- (instancetype _Nullable)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error;

/// Creates a new blob from the specified file.
///
Expand All @@ -98,7 +98,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - Will be set if an error occurs. This may be nil.
///
/// Returns a newly created blob object, or nil if an error occurs.
- (instancetype _Nullable)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error;
- (instancetype _Nullable)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error;

/// The underlying `git_object` as a `git_blob` object.
- (git_blob *)git_blob __attribute__((objc_returns_inner_pointer));
Expand All @@ -113,7 +113,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - If not NULL, set to any error that occurs.
///
/// Returns the filtered data, or nil if an error occurs.
- (NSData * _Nullable)applyFiltersForPath:(NSString *)path error:(NSError **)error;
- (NSData * _Nullable)applyFiltersForPath:(NSString *)path error:(NSError * __autoreleasing *)error;

@end

Expand Down
24 changes: 13 additions & 11 deletions ObjectiveGit/GTBlob.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,19 @@ - (NSString *)description {

#pragma mark API

+ (instancetype)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error {
+ (instancetype)blobWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
return [[self alloc] initWithString:string inRepository:repository error:error];
}

+ (instancetype)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error {
+ (instancetype)blobWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
return [[self alloc] initWithData:data inRepository:repository error:error];
}

+ (instancetype)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error {
+ (instancetype)blobWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
return [[self alloc] initWithFile:file inRepository:repository error:error];
}

- (instancetype)initWithOid:(const git_oid *)oid inRepository:(GTRepository *)repository error:(NSError **)error {
- (instancetype)initWithOid:(const git_oid *)oid inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
NSParameterAssert(oid != NULL);
NSParameterAssert(repository != nil);

Expand All @@ -74,17 +74,17 @@ - (instancetype)initWithOid:(const git_oid *)oid inRepository:(GTRepository *)re
return [self initWithObj:obj inRepository:repository];
}

- (instancetype)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError **)error {
- (instancetype)initWithString:(NSString *)string inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
return [self initWithData:data inRepository:repository error:error];
}

- (instancetype)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError **)error {
- (instancetype)initWithData:(NSData *)data inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
NSParameterAssert(data != nil);
NSParameterAssert(repository != nil);

git_oid oid;
int gitError = git_blob_create_frombuffer(&oid, repository.git_repository, [data bytes], data.length);
int gitError = git_blob_create_from_buffer(&oid, repository.git_repository, [data bytes], data.length);
if(gitError < GIT_OK) {
if(error != NULL) {
*error = [NSError git_errorFor:gitError description:@"Failed to create blob from NSData"];
Expand All @@ -95,12 +95,12 @@ - (instancetype)initWithData:(NSData *)data inRepository:(GTRepository *)reposit
return [self initWithOid:&oid inRepository:repository error:error];
}

- (instancetype)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError **)error {
- (instancetype)initWithFile:(NSURL *)file inRepository:(GTRepository *)repository error:(NSError * __autoreleasing *)error {
NSParameterAssert(file != nil);
NSParameterAssert(repository != nil);

git_oid oid;
int gitError = git_blob_create_fromdisk(&oid, repository.git_repository, [[file path] fileSystemRepresentation]);
int gitError = git_blob_create_from_disk(&oid, repository.git_repository, [[file path] fileSystemRepresentation]);
if(gitError < GIT_OK) {
if(error != NULL) {
*error = [NSError git_errorFor:gitError description:@"Failed to create blob from NSURL"];
Expand Down Expand Up @@ -133,11 +133,13 @@ - (NSData *)data {
return [NSData dataWithBytes:git_blob_rawcontent(self.git_blob) length:(NSUInteger)s];
}

- (NSData *)applyFiltersForPath:(NSString *)path error:(NSError **)error {
- (NSData *)applyFiltersForPath:(NSString *)path error:(NSError * __autoreleasing *)error {
NSCParameterAssert(path != nil);

git_buf buffer = GIT_BUF_INIT_CONST(0, NULL);
int gitError = git_blob_filtered_content(&buffer, self.git_blob, path.UTF8String, 1);

git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
int gitError = git_blob_filter(&buffer, self.git_blob, path.UTF8String, &opts);
if (gitError != GIT_OK) {
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to apply filters for path %@ to blob", path];
return nil;
Expand Down
18 changes: 9 additions & 9 deletions ObjectiveGit/GTBranch.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,33 @@ NS_ASSUME_NONNULL_BEGIN
/// error(out) - will be filled if an error occurs
///
/// returns a GTCommit object or nil if an error occurred
- (GTCommit * _Nullable)targetCommitWithError:(NSError **)error;
- (GTCommit * _Nullable)targetCommitWithError:(NSError * __autoreleasing *)error;

/// Renames the branch. Setting `force` to YES to delete another branch with the same name.
- (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError **)error;
- (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError * __autoreleasing *)error;

/// Count all commits in this branch
///
/// error(out) - will be filled if an error occurs
///
/// returns number of commits in the branch or NSNotFound if an error occurred
- (NSUInteger)numberOfCommitsWithError:(NSError **)error;
- (NSUInteger)numberOfCommitsWithError:(NSError * __autoreleasing *)error;

/// Get unique commits
///
/// otherBranch -
/// error - If not NULL, set to any error that occurs.
///
/// Returns a (possibly empty) array of GTCommits, or nil if an error occurs.
- (NSArray<GTCommit *> * _Nullable)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error;
- (NSArray<GTCommit *> * _Nullable)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError * __autoreleasing *)error;

/// Deletes the local branch and nils out the reference.
- (BOOL)deleteWithError:(NSError **)error;
- (BOOL)deleteWithError:(NSError * __autoreleasing *)error;

/// If the receiver is a local branch, looks up and returns its tracking branch.
/// If the receiver is a remote branch, returns self. If no tracking branch was
/// found, returns nil and sets `success` to YES.
- (GTBranch * _Nullable)trackingBranchWithError:(NSError **)error success:(BOOL * _Nullable)success;
- (GTBranch * _Nullable)trackingBranchWithError:(NSError * __autoreleasing *)error success:(BOOL * _Nullable)success;

/// Update the tracking branch.
///
Expand All @@ -111,7 +111,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - The error if one occurred.
///
/// Returns whether it was successful.
- (BOOL)updateTrackingBranch:(GTBranch * _Nullable)trackingBranch error:(NSError **)error;
- (BOOL)updateTrackingBranch:(GTBranch * _Nullable)trackingBranch error:(NSError * __autoreleasing *)error;

/// Reloads the branch's reference and creates a new branch based off that newly
/// loaded reference.
Expand All @@ -121,7 +121,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - The error if one occurred.
///
/// Returns the reloaded branch, or nil if an error occurred.
- (GTBranch * _Nullable)reloadedBranchWithError:(NSError **)error;
- (GTBranch * _Nullable)reloadedBranchWithError:(NSError * __autoreleasing *)error;

/// Calculate the ahead/behind count from this branch to the given branch.
///
Expand All @@ -132,7 +132,7 @@ NS_ASSUME_NONNULL_BEGIN
/// error - The error if one occurs.
///
/// Returns whether the calculation was successful.
- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError **)error;
- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError * __autoreleasing *)error;

@end

Expand Down
18 changes: 9 additions & 9 deletions ObjectiveGit/GTBranch.m
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ - (NSString *)remoteName {
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
}

- (GTCommit *)targetCommitWithError:(NSError **)error {
- (GTCommit *)targetCommitWithError:(NSError * __autoreleasing *)error {
GTOID *oid = self.OID;
if (oid == nil) {
if (error != NULL) *error = GTReference.invalidReferenceError;
Expand All @@ -133,7 +133,7 @@ - (GTCommit *)targetCommitWithError:(NSError **)error {
return [self.repository lookUpObjectByOID:oid objectType:GTObjectTypeCommit error:error];
}

- (NSUInteger)numberOfCommitsWithError:(NSError **)error {
- (NSUInteger)numberOfCommitsWithError:(NSError * __autoreleasing *)error {
GTEnumerator *enumerator = [[GTEnumerator alloc] initWithRepository:self.repository error:error];
if (enumerator == nil) return NSNotFound;

Expand All @@ -160,14 +160,14 @@ - (BOOL)isHEAD {
return (git_branch_is_head(self.reference.git_reference) ? YES : NO);
}

- (NSArray *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError **)error {
- (NSArray *)uniqueCommitsRelativeToBranch:(GTBranch *)otherBranch error:(NSError * __autoreleasing *)error {
GTOID *oid = self.OID;
GTOID *otherOID = otherBranch.OID;
GTEnumerator *enumerator = [self.repository enumeratorForUniqueCommitsFromOID:oid relativeToOID:otherOID error:error];
return [enumerator allObjectsWithError:error];
}

- (BOOL)deleteWithError:(NSError **)error {
- (BOOL)deleteWithError:(NSError * __autoreleasing *)error {
int gitError = git_branch_delete(self.reference.git_reference);
if (gitError != GIT_OK) {
if(error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to delete branch %@", self.name];
Expand All @@ -177,7 +177,7 @@ - (BOOL)deleteWithError:(NSError **)error {
return YES;
}

- (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError **)error {
- (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError * __autoreleasing *)error {
git_reference *git_ref;
int gitError = git_branch_move(&git_ref, self.reference.git_reference, name.UTF8String, (force ? 1 : 0));
if (gitError != GIT_OK) {
Expand All @@ -192,7 +192,7 @@ - (BOOL)rename:(NSString *)name force:(BOOL)force error:(NSError **)error {
return YES;
}

- (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success {
- (GTBranch *)trackingBranchWithError:(NSError * __autoreleasing *)error success:(BOOL *)success {
BOOL underSuccess = NO;
if (success == NULL) {
success = &underSuccess;
Expand Down Expand Up @@ -236,7 +236,7 @@ - (GTBranch *)trackingBranchWithError:(NSError **)error success:(BOOL *)success
return [[self class] branchWithReference:upsteamRef];
}

- (BOOL)updateTrackingBranch:(GTBranch *)trackingBranch error:(NSError **)error {
- (BOOL)updateTrackingBranch:(GTBranch *)trackingBranch error:(NSError * __autoreleasing *)error {
int result = GIT_ENOTFOUND;
if (trackingBranch.branchType == GTBranchTypeRemote) {
result = git_branch_set_upstream(self.reference.git_reference, [trackingBranch.name stringByReplacingOccurrencesOfString:[GTBranch remoteNamePrefix] withString:@""].UTF8String);
Expand All @@ -251,14 +251,14 @@ - (BOOL)updateTrackingBranch:(GTBranch *)trackingBranch error:(NSError **)error
return YES;
}

- (GTBranch *)reloadedBranchWithError:(NSError **)error {
- (GTBranch *)reloadedBranchWithError:(NSError * __autoreleasing *)error {
GTReference *reloadedRef = [self.reference reloadedReferenceWithError:error];
if (reloadedRef == nil) return nil;

return [[self.class alloc] initWithReference:reloadedRef];
}

- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError **)error {
- (BOOL)calculateAhead:(size_t *)ahead behind:(size_t *)behind relativeTo:(GTBranch *)branch error:(NSError * __autoreleasing *)error {
GTOID *oid = self.OID;
GTOID *branchOID = branch.OID;
return [self.repository calculateAhead:ahead behind:behind ofOID:oid relativeToOID:branchOID error:error];
Expand Down
4 changes: 2 additions & 2 deletions ObjectiveGit/GTCheckoutOptions.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static int GTCheckoutNotifyCallback(git_checkout_notify_t why, const char *path,
}

- (git_checkout_options *)git_checkoutOptions {
_git_checkoutOptions.checkout_strategy = self.strategy;
_git_checkoutOptions.checkout_strategy = (unsigned int)self.strategy;

if (self.progressBlock != nil) {
_git_checkoutOptions.progress_cb = GTCheckoutProgressCallback;
Expand All @@ -88,7 +88,7 @@ - (git_checkout_options *)git_checkoutOptions {

if (self.notifyBlock != nil) {
_git_checkoutOptions.notify_cb = GTCheckoutNotifyCallback;
_git_checkoutOptions.notify_flags = self.notifyFlags;
_git_checkoutOptions.notify_flags = (unsigned int)self.notifyFlags;
_git_checkoutOptions.notify_payload = (__bridge void *)self.notifyBlock;
}

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTCommit.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ NS_ASSUME_NONNULL_BEGIN
///
/// Returns an index which represents the result of the merge, or nil if an error
/// occurred.
- (GTIndex * _Nullable)merge:(GTCommit *)otherCommit error:(NSError **)error;
- (GTIndex * _Nullable)merge:(GTCommit *)otherCommit error:(NSError * __autoreleasing *)error;

@end

Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTCommit.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ - (NSArray *)parents {

#pragma mark Merging

- (GTIndex *)merge:(GTCommit *)otherCommit error:(NSError **)error {
- (GTIndex *)merge:(GTCommit *)otherCommit error:(NSError * __autoreleasing *)error {
NSParameterAssert(otherCommit != nil);

git_index *index;
Expand Down
2 changes: 1 addition & 1 deletion ObjectiveGit/GTConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)setInt64:(int64_t)i forKey:(NSString *)key;
- (int64_t)int64ForKey:(NSString *)key;

- (BOOL)deleteValueForKey:(NSString *)key error:(NSError **)error;
- (BOOL)deleteValueForKey:(NSString *)key error:(NSError * __autoreleasing *)error;

@end

Expand Down
Loading