From 1cedfd055dbab5c45a91df0d3b6959140c3ccbdc Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Wed, 9 Feb 2022 13:30:43 +0100 Subject: [PATCH] More changes --- ObjectiveGit/GTOID.m | 2 +- ObjectiveGit/GTRepository+Merging.m | 8 ++++---- ObjectiveGit/GTRepository+Pull.h | 2 +- ObjectiveGit/GTRepository+RemoteOperations.h | 2 +- ObjectiveGit/GTRepository+RemoteOperations.m | 6 +++--- ObjectiveGit/GTRepository.m | 6 +++--- ObjectiveGitTests/GTRemoteSpec.m | 2 +- ObjectiveGitTests/GTRepository+PullSpec.m | 10 +++++----- ObjectiveGitTests/GTRepositorySpec.m | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index 8010c2885..57bb06867 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -98,7 +98,7 @@ + (instancetype)oidWithSHACString:(const char *)SHA { } - (BOOL)isZero { - return git_oid_iszero(self.git_oid) != 0; + return git_oid_is_zero(self.git_oid) != 0; } #pragma mark NSObject diff --git a/ObjectiveGit/GTRepository+Merging.m b/ObjectiveGit/GTRepository+Merging.m index f7b9837df..3832024f6 100644 --- a/ObjectiveGit/GTRepository+Merging.m +++ b/ObjectiveGit/GTRepository+Merging.m @@ -20,7 +20,7 @@ #import "GTOdbObject.h" #import "GTObjectDatabase.h" -typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); +typedef void (^GTRemoteFetchTransferProgressBlock)(const git_indexer_progress *stats, BOOL *stop); @implementation GTRepository (Merging) @@ -181,7 +181,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS // initialize the ancestor's merge file input git_merge_file_input ancestorInput; - int gitError = git_merge_file_init_input(&ancestorInput, GIT_MERGE_FILE_INPUT_VERSION); + int gitError = git_merge_file_input_init(&ancestorInput, GIT_MERGE_FILE_INPUT_VERSION); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input for ancestor"]; return nil; @@ -199,7 +199,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS // initialize our merge file input git_merge_file_input ourInput; - gitError = git_merge_file_init_input(&ourInput, GIT_MERGE_FILE_INPUT_VERSION); + gitError = git_merge_file_options_init(&ourInput, GIT_MERGE_FILE_INPUT_VERSION); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input for our side"]; return nil; @@ -217,7 +217,7 @@ - (NSString * _Nullable)contentsOfDiffWithAncestor:(GTIndexEntry *)ancestor ourS // initialize their merge file input git_merge_file_input theirInput; - gitError = git_merge_file_init_input(&theirInput, GIT_MERGE_FILE_INPUT_VERSION); + gitError = git_merge_file_input_init(&theirInput, GIT_MERGE_FILE_INPUT_VERSION); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to create merge file input other side"]; return nil; diff --git a/ObjectiveGit/GTRepository+Pull.h b/ObjectiveGit/GTRepository+Pull.h index cbc1f74fd..939930e20 100644 --- a/ObjectiveGit/GTRepository+Pull.h +++ b/ObjectiveGit/GTRepository+Pull.h @@ -10,7 +10,7 @@ NS_ASSUME_NONNULL_BEGIN -typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop); +typedef void (^GTRemoteFetchTransferProgressBlock)(const git_indexer_progress *progress, BOOL *stop); @interface GTRepository (Pull) diff --git a/ObjectiveGit/GTRepository+RemoteOperations.h b/ObjectiveGit/GTRepository+RemoteOperations.h index d93ebaad7..0e292dda1 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.h +++ b/ObjectiveGit/GTRepository+RemoteOperations.h @@ -51,7 +51,7 @@ typedef NS_ENUM(NSInteger, GTFetchPruneOption) { /// /// Returns YES if the fetch was successful, NO otherwise (and `error`, if provided, /// will point to an error describing what happened). -- (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(const git_transfer_progress *stats, BOOL *stop))progressBlock; +- (BOOL)fetchRemote:(GTRemote *)remote withOptions:(NSDictionary * _Nullable)options error:(NSError **)error progress:(void (^ _Nullable)(const git_indexer_progress *stats, BOOL *stop))progressBlock; /// Enumerate all available fetch head entries. /// diff --git a/ObjectiveGit/GTRepository+RemoteOperations.m b/ObjectiveGit/GTRepository+RemoteOperations.m index 57c92096a..7865d31cb 100644 --- a/ObjectiveGit/GTRepository+RemoteOperations.m +++ b/ObjectiveGit/GTRepository+RemoteOperations.m @@ -30,7 +30,7 @@ NSString *const GTRepositoryRemoteOptionsDownloadTags = @"GTRepositoryRemoteOptionsDownloadTags"; NSString *const GTRepositoryRemoteOptionsPushNotes = @"GTRepositoryRemoteOptionsPushNotes"; -typedef void (^GTRemoteFetchTransferProgressBlock)(const git_transfer_progress *stats, BOOL *stop); +typedef void (^GTRemoteFetchTransferProgressBlock)(const git_indexer_progress *stats, BOOL *stop); typedef void (^GTRemotePushTransferProgressBlock)(unsigned int current, unsigned int total, size_t bytes, BOOL *stop); @implementation GTRepository (RemoteOperations) @@ -45,7 +45,7 @@ @implementation GTRepository (RemoteOperations) git_direction direction; } GTRemoteConnectionInfo; -int GTRemoteFetchTransferProgressCallback(const git_transfer_progress *stats, void *payload) { +int GTRemoteFetchTransferProgressCallback(const git_indexer_progress *stats, void *payload) { GTRemoteConnectionInfo *info = payload; BOOL stop = NO; @@ -281,7 +281,7 @@ - (BOOL)pushRefspecs:(NSArray *)refspecs toRemote:(GTRemote *)remote withOptions git_push_options push_options = GIT_PUSH_OPTIONS_INIT; - gitError = git_push_init_options(&push_options, GIT_PUSH_OPTIONS_VERSION); + gitError = git_push_options_init(&push_options, GIT_PUSH_OPTIONS_VERSION); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to init push options"]; return NO; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 2af904d8e..035a2ca66 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -214,9 +214,9 @@ - (instancetype)initWithURL:(NSURL *)localFileURL flags:(NSInteger)flags ceiling } -typedef void(^GTTransferProgressBlock)(const git_transfer_progress *progress, BOOL *stop); +typedef void(^GTTransferProgressBlock)(const git_indexer_progress *progress, BOOL *stop); -static int transferProgressCallback(const git_transfer_progress *progress, void *payload) { +static int transferProgressCallback(const git_indexer_progress *progress, void *payload) { if (payload == NULL) return 0; struct GTClonePayload *pld = payload; if (pld->transferProgressBlock == NULL) return 0; @@ -244,7 +244,7 @@ static int remoteCreate(git_remote **remote, git_repository *repo, const char *n git_remote_callbacks remoteCallbacks; }; -+ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_transfer_progress *, BOOL *stop))transferProgressBlock { ++ (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL options:(NSDictionary * _Nullable)options error:(NSError **)error transferProgressBlock:(void (^ _Nullable)(const git_indexer_progress *, BOOL *stop))transferProgressBlock { git_clone_options cloneOptions = GIT_CLONE_OPTIONS_INIT; diff --git a/ObjectiveGitTests/GTRemoteSpec.m b/ObjectiveGitTests/GTRemoteSpec.m index e7ac77891..0269a3f67 100644 --- a/ObjectiveGitTests/GTRemoteSpec.m +++ b/ObjectiveGitTests/GTRemoteSpec.m @@ -180,7 +180,7 @@ __block unsigned int receivedObjects = 0; __block BOOL transferProgressed = NO; - BOOL success = [fetchingRepo fetchRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *stats, BOOL *stop) { + BOOL success = [fetchingRepo fetchRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *stats, BOOL *stop) { receivedObjects += stats->received_objects; transferProgressed = YES; }]; diff --git a/ObjectiveGitTests/GTRepository+PullSpec.m b/ObjectiveGitTests/GTRepository+PullSpec.m index 3c36ebde6..77eb77126 100644 --- a/ObjectiveGitTests/GTRepository+PullSpec.m +++ b/ObjectiveGitTests/GTRepository+PullSpec.m @@ -79,7 +79,7 @@ // Pull __block BOOL transferProgressed = NO; - BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) { + BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) { transferProgressed = YES; }]; expect(error).to(beNil()); @@ -124,7 +124,7 @@ // Pull __block BOOL transferProgressed = NO; - BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) { + BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) { transferProgressed = YES; }]; expect(@(result)).to(beTruthy()); @@ -165,7 +165,7 @@ // Pull __block BOOL transferProgressed = NO; - BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) { + BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) { transferProgressed = YES; }]; expect(error).to(beNil()); @@ -219,7 +219,7 @@ // Pull __block BOOL transferProgressed = NO; - BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) { + BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) { transferProgressed = YES; }]; expect(@(result)).to(beTruthy()); @@ -251,7 +251,7 @@ // Pull __block BOOL transferProgressed = NO; - BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_transfer_progress *progress, BOOL *stop) { + BOOL result = [localRepo pullBranch:masterBranch fromRemote:remote withOptions:nil error:&error progress:^(const git_indexer_progress *progress, BOOL *stop) { transferProgressed = YES; }]; NSString *fileContents = [NSString stringWithContentsOfURL:[localRepo.fileURL URLByAppendingPathComponent:@"test.txt"] encoding:NSUTF8StringEncoding error:nil]; diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 2ff1aaf88..88d7571de 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -68,7 +68,7 @@ describe(@"+cloneFromURL:toWorkingDirectory:options:error:transferProgressBlock:checkoutProgressBlock:", ^{ __block BOOL transferProgressCalled = NO; __block BOOL checkoutProgressCalled = NO; - __block void (^transferProgressBlock)(const git_transfer_progress *, BOOL *); + __block void (^transferProgressBlock)(const git_indexer_progress *, BOOL *); __block void (^checkoutProgressBlock)(NSString *, NSUInteger, NSUInteger); __block NSURL *originURL; __block NSURL *workdirURL; @@ -78,7 +78,7 @@ beforeEach(^{ transferProgressCalled = NO; checkoutProgressCalled = NO; - transferProgressBlock = ^(const git_transfer_progress *progress, BOOL *stop) { + transferProgressBlock = ^(const git_indexer_progress *progress, BOOL *stop) { transferProgressCalled = YES; }; checkoutProgressBlock = ^(NSString *path, NSUInteger completedSteps, NSUInteger totalSteps) {