From a9cd846cfdedaaa389bc5ffc409ad32ae28fc3c5 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Sun, 3 Feb 2019 17:05:35 +0100 Subject: [PATCH 1/2] Update Carthage dependencies --- Cartfile.private | 6 +++--- Cartfile.resolved | 6 +++--- Carthage/Checkouts/Nimble | 2 +- Carthage/Checkouts/Quick | 2 +- Carthage/Checkouts/ZipArchive | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cartfile.private b/Cartfile.private index 476c2a1f6..0dfa9b497 100644 --- a/Cartfile.private +++ b/Cartfile.private @@ -1,4 +1,4 @@ github "jspahrsummers/xcconfigs" "master" -github "Quick/Quick" ~> 1.2.0 -github "Quick/Nimble" ~> 7.1.0 -github "ZipArchive/ZipArchive" ~> 2.1.2 +github "Quick/Quick" ~> 1.3.4 +github "Quick/Nimble" ~> 7.3.3 +github "ZipArchive/ZipArchive" ~> 2.1.4 diff --git a/Cartfile.resolved b/Cartfile.resolved index ef51bc1cb..36c5288e0 100644 --- a/Cartfile.resolved +++ b/Cartfile.resolved @@ -1,4 +1,4 @@ -github "Quick/Nimble" "v7.1.0" -github "Quick/Quick" "v1.2.0" -github "ZipArchive/ZipArchive" "v2.1.2" +github "Quick/Nimble" "v7.3.3" +github "Quick/Quick" "v1.3.4" +github "ZipArchive/ZipArchive" "v2.1.4" github "jspahrsummers/xcconfigs" "bb795558a76e5daf3688500055bbcfe243bffa8d" diff --git a/Carthage/Checkouts/Nimble b/Carthage/Checkouts/Nimble index 5e11474ae..9a281b1cf 160000 --- a/Carthage/Checkouts/Nimble +++ b/Carthage/Checkouts/Nimble @@ -1 +1 @@ -Subproject commit 5e11474ae6ea796a07e722fea49269d26710744d +Subproject commit 9a281b1cfa1c53d1e8bd92e1798e4e473af8d263 diff --git a/Carthage/Checkouts/Quick b/Carthage/Checkouts/Quick index 0ff81f2c6..f2b5a0644 160000 --- a/Carthage/Checkouts/Quick +++ b/Carthage/Checkouts/Quick @@ -1 +1 @@ -Subproject commit 0ff81f2c665b4381f526bd656f8708dd52a9ea2f +Subproject commit f2b5a06440ea87eba1a167cab37bf6496646c52e diff --git a/Carthage/Checkouts/ZipArchive b/Carthage/Checkouts/ZipArchive index 3ad651c62..e8b08ceb6 160000 --- a/Carthage/Checkouts/ZipArchive +++ b/Carthage/Checkouts/ZipArchive @@ -1 +1 @@ -Subproject commit 3ad651c62c059102acc7384dae6b0d4e0142e990 +Subproject commit e8b08ceb6ab9ff56e0826913b13680a129a92828 From 7ab537e53f81b18d6afc6732405c200842fe8179 Mon Sep 17 00:00:00 2001 From: Etienne Samson Date: Fri, 8 Feb 2019 23:36:17 +0100 Subject: [PATCH 2/2] Update to libgit2 v0.28.0-rc1 --- External/libgit2 | 2 +- ObjectiveGit/Categories/NSData+Git.m | 2 +- ObjectiveGit/Categories/NSError+Git.m | 4 ++-- ObjectiveGit/GTBlob.m | 2 +- ObjectiveGit/GTCredential.m | 4 ++-- ObjectiveGit/GTDiffPatch.m | 2 +- ObjectiveGit/GTIndexEntry.m | 2 +- ObjectiveGit/GTNote.m | 2 +- ObjectiveGit/GTOID.m | 2 +- ObjectiveGit/GTObject.h | 18 ++++++++---------- ObjectiveGit/GTObject.m | 14 +++++++------- ObjectiveGit/GTObjectDatabase.m | 2 +- ObjectiveGit/GTReference.h | 6 +++--- ObjectiveGit/GTReference.m | 8 ++++---- ObjectiveGit/GTRepository.m | 6 +++--- ObjectiveGit/GTTreeBuilder.m | 2 +- ObjectiveGitTests/GTReferenceSpec.m | 6 +++--- ObjectiveGitTests/GTRepositorySpec.m | 6 +++--- 18 files changed, 44 insertions(+), 46 deletions(-) diff --git a/External/libgit2 b/External/libgit2 index f23dc5b29..1a107fac0 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit f23dc5b29f1394928a940d7ec447f4bfd53dad1f +Subproject commit 1a107fac0fc88a4d74b64ffc9ae2fd178ba631c0 diff --git a/ObjectiveGit/Categories/NSData+Git.m b/ObjectiveGit/Categories/NSData+Git.m index 2f06dd9fc..6498dfbe0 100644 --- a/ObjectiveGit/Categories/NSData+Git.m +++ b/ObjectiveGit/Categories/NSData+Git.m @@ -17,7 +17,7 @@ - (BOOL)git_getOid:(git_oid *)oid error:(NSError **)error { if ([self length] != sizeof(git_oid)) { if (error != NULL) { *error = [NSError errorWithDomain:GTGitErrorDomain - code:GITERR_INVALID + code:GIT_ERROR_INVALID userInfo: [NSDictionary dictionaryWithObject:@"can't extract oid from data of incorrect length" forKey:NSLocalizedDescriptionKey]]; diff --git a/ObjectiveGit/Categories/NSError+Git.m b/ObjectiveGit/Categories/NSError+Git.m index e66d2fcb3..422b32d1f 100644 --- a/ObjectiveGit/Categories/NSError+Git.m +++ b/ObjectiveGit/Categories/NSError+Git.m @@ -98,10 +98,10 @@ + (NSError *)git_errorFor:(int)code { } + (NSString *)git_descriptionForErrorCode:(int)code { - const git_error *gitLastError = giterr_last(); + const git_error *gitLastError = git_error_last(); if (gitLastError != NULL) { return @(gitLastError->message); - } else if (code == GITERR_OS) { + } else if (code == GIT_ERROR_OS) { return @(strerror(errno)); } else { return nil; diff --git a/ObjectiveGit/GTBlob.m b/ObjectiveGit/GTBlob.m index 1f1e5213c..a1634dcf5 100644 --- a/ObjectiveGit/GTBlob.m +++ b/ObjectiveGit/GTBlob.m @@ -63,7 +63,7 @@ - (instancetype)initWithOid:(const git_oid *)oid inRepository:(GTRepository *)re NSParameterAssert(repository != nil); git_object *obj; - int gitError = git_object_lookup(&obj, repository.git_repository, oid, (git_otype) GTObjectTypeBlob); + int gitError = git_object_lookup(&obj, repository.git_repository, oid, (git_object_t) GTObjectTypeBlob); if (gitError < GIT_OK) { if (error != NULL) { *error = [NSError git_errorFor:gitError description:@"Failed to lookup blob"]; diff --git a/ObjectiveGit/GTCredential.m b/ObjectiveGit/GTCredential.m index 0ee809b0e..1d3894b44 100644 --- a/ObjectiveGit/GTCredential.m +++ b/ObjectiveGit/GTCredential.m @@ -105,7 +105,7 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char GTCredentialProvider *provider = info->credProvider; if (provider == nil) { - giterr_set_str(GIT_EUSER, "No GTCredentialProvider set, but authentication was requested."); + git_error_set_str(GIT_EUSER, "No GTCredentialProvider set, but authentication was requested."); return GIT_ERROR; } @@ -114,7 +114,7 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char GTCredential *cred = [provider credentialForType:(GTCredentialType)allowed_types URL:URL userName:userName]; if (cred == nil) { - giterr_set_str(GIT_EUSER, "GTCredentialProvider failed to provide credentials."); + git_error_set_str(GIT_EUSER, "GTCredentialProvider failed to provide credentials."); return GIT_ERROR; } diff --git a/ObjectiveGit/GTDiffPatch.m b/ObjectiveGit/GTDiffPatch.m index fe28d662a..715db5a13 100644 --- a/ObjectiveGit/GTDiffPatch.m +++ b/ObjectiveGit/GTDiffPatch.m @@ -69,7 +69,7 @@ - (NSData *)patchData { git_patch_to_buf(&buf, self.git_patch); NSData *buffer = [[NSData alloc] initWithBytes:buf.ptr length:buf.size]; - git_buf_free(&buf); + git_buf_dispose(&buf); return buffer; } diff --git a/ObjectiveGit/GTIndexEntry.m b/ObjectiveGit/GTIndexEntry.m index 855393c3d..c687d0060 100644 --- a/ObjectiveGit/GTIndexEntry.m +++ b/ObjectiveGit/GTIndexEntry.m @@ -127,7 +127,7 @@ + (instancetype)objectWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError * - (instancetype)initWithIndexEntry:(GTIndexEntry *)indexEntry error:(NSError **)error { git_object *obj; - int gitError = git_object_lookup(&obj, indexEntry.repository.git_repository, indexEntry.OID.git_oid, (git_otype)GTObjectTypeAny); + int gitError = git_object_lookup(&obj, indexEntry.repository.git_repository, indexEntry.OID.git_oid, (git_object_t)GTObjectTypeAny); if (gitError < GIT_OK) { if (error != NULL) { diff --git a/ObjectiveGit/GTNote.m b/ObjectiveGit/GTNote.m index 4562b0845..b87039de1 100644 --- a/ObjectiveGit/GTNote.m +++ b/ObjectiveGit/GTNote.m @@ -98,7 +98,7 @@ + (NSString *)defaultReferenceNameForRepository:(GTRepository *)repository error if (error != NULL) *error = [NSError git_errorFor:GIT_ERROR description:@"Unable to get default git notes reference name"]; } - git_buf_free(&default_ref_name); + git_buf_dispose(&default_ref_name); return noteRef; } diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index c97da8735..8010c2885 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -133,7 +133,7 @@ + (instancetype)OIDByHashingData:(NSData *)data type:(GTObjectType)type error:(N NSParameterAssert(data != nil); git_oid oid; - int gitError = git_odb_hash(&oid, data.bytes, data.length, (git_otype)type); + int gitError = git_odb_hash(&oid, data.bytes, data.length, (git_object_t)type); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to hash"]; return nil; diff --git a/ObjectiveGit/GTObject.h b/ObjectiveGit/GTObject.h index 66ef8b89c..a74ed418c 100644 --- a/ObjectiveGit/GTObject.h +++ b/ObjectiveGit/GTObject.h @@ -31,16 +31,14 @@ #import "git2/types.h" typedef NS_ENUM(int, GTObjectType) { - GTObjectTypeAny = GIT_OBJ_ANY, /**< Object can be any of the following */ - GTObjectTypeBad = GIT_OBJ_BAD, /**< Object is invalid. */ - GTObjectTypeExt1 = GIT_OBJ__EXT1, /**< Reserved for future use. */ - GTObjectTypeCommit = GIT_OBJ_COMMIT, /**< A commit object. */ - GTObjectTypeTree = GIT_OBJ_TREE, /**< A tree (directory listing) object. */ - GTObjectTypeBlob = GIT_OBJ_BLOB, /**< A file revision object. */ - GTObjectTypeTag = GIT_OBJ_TAG, /**< An annotated tag object. */ - GTObjectTypeExt2 = GIT_OBJ__EXT2, /**< Reserved for future use. */ - GTObjectTypeOffsetDelta = GIT_OBJ_OFS_DELTA,/**< A delta, base is given by an offset. */ - GTObjectTypeRefDelta = GIT_OBJ_REF_DELTA, /**< A delta, base is given by object id. */ + GTObjectTypeAny = GIT_OBJECT_ANY, /**< Object can be any of the following */ + GTObjectTypeBad = GIT_OBJECT_INVALID, /**< Object is invalid. */ + GTObjectTypeCommit = GIT_OBJECT_COMMIT, /**< A commit object. */ + GTObjectTypeTree = GIT_OBJECT_TREE, /**< A tree (directory listing) object. */ + GTObjectTypeBlob = GIT_OBJECT_BLOB, /**< A file revision object. */ + GTObjectTypeTag = GIT_OBJECT_TAG, /**< An annotated tag object. */ + GTObjectTypeOffsetDelta = GIT_OBJECT_OFS_DELTA,/**< A delta, base is given by an offset. */ + GTObjectTypeRefDelta = GIT_OBJECT_REF_DELTA, /**< A delta, base is given by object id. */ }; @class GTRepository; diff --git a/ObjectiveGit/GTObject.m b/ObjectiveGit/GTObject.m index 46ae4ae0e..503585092 100644 --- a/ObjectiveGit/GTObject.m +++ b/ObjectiveGit/GTObject.m @@ -82,18 +82,18 @@ - (id)initWithObj:(git_object *)object inRepository:(GTRepository *)repo { NSAssert(object_repo == repo.git_repository, @"object %p doesn't belong to repo %@", object, repo); Class objectClass = nil; - git_otype t = git_object_type(object); + git_object_t t = git_object_type(object); switch (t) { - case GIT_OBJ_COMMIT: + case GIT_OBJECT_COMMIT: objectClass = [GTCommit class]; break; - case GIT_OBJ_TREE: + case GIT_OBJECT_TREE: objectClass = [GTTree class]; break; - case GIT_OBJ_BLOB: + case GIT_OBJECT_BLOB: objectClass = [GTBlob class]; break; - case GIT_OBJ_TAG: + case GIT_OBJECT_TAG: objectClass = [GTTag class]; break; default: @@ -101,7 +101,7 @@ - (id)initWithObj:(git_object *)object inRepository:(GTRepository *)repo { } if (!objectClass) { - NSLog(@"Unknown git_otype %s (%d)", git_object_type2string(t), (int)t); + NSLog(@"Unknown git_object_t %s (%d)", git_object_type2string(t), (int)t); return nil; } @@ -149,7 +149,7 @@ - (GTOdbObject *)odbObjectWithError:(NSError **)error { - (id)objectByPeelingToType:(GTObjectType)type error:(NSError **)error { git_object *peeled = NULL; - int gitError = git_object_peel(&peeled, self.git_object, (git_otype)type); + int gitError = git_object_peel(&peeled, self.git_object, (git_object_t)type); if (gitError != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Cannot peel object"]; return nil; diff --git a/ObjectiveGit/GTObjectDatabase.m b/ObjectiveGit/GTObjectDatabase.m index 534df08da..99c431a48 100644 --- a/ObjectiveGit/GTObjectDatabase.m +++ b/ObjectiveGit/GTObjectDatabase.m @@ -102,7 +102,7 @@ - (GTOID *)writeData:(NSData *)data type:(GTObjectType)type error:(NSError **)er NSParameterAssert(data != nil); git_odb_stream *stream; - int gitError = git_odb_open_wstream(&stream, self.git_odb, data.length, (git_otype)type); + int gitError = git_odb_open_wstream(&stream, self.git_odb, data.length, (git_object_t)type); @onExit { if (stream != NULL) git_odb_stream_free(stream); }; diff --git a/ObjectiveGit/GTReference.h b/ObjectiveGit/GTReference.h index 786739fac..c24a9fc7b 100644 --- a/ObjectiveGit/GTReference.h +++ b/ObjectiveGit/GTReference.h @@ -34,9 +34,9 @@ typedef NS_ENUM(NSInteger, GTReferenceErrorCode) { }; typedef NS_OPTIONS(NSInteger, GTReferenceType) { - GTReferenceTypeInvalid = GIT_REF_INVALID, /** Invalid reference */ - GTReferenceTypeOid = GIT_REF_OID, /** A reference which points at an object id */ - GTReferenceTypeSymbolic = GIT_REF_SYMBOLIC, /** A reference which points at another reference */ + GTReferenceTypeInvalid = GIT_REFERENCE_INVALID, /** Invalid reference */ + GTReferenceTypeDirect = GIT_REFERENCE_DIRECT, /** A reference which points at an object id */ + GTReferenceTypeSymbolic = GIT_REFERENCE_SYMBOLIC, /** A reference which points at another reference */ }; NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectiveGit/GTReference.m b/ObjectiveGit/GTReference.m index 2baacdacb..080375dd2 100644 --- a/ObjectiveGit/GTReference.m +++ b/ObjectiveGit/GTReference.m @@ -45,7 +45,7 @@ @interface GTReference () case GTReferenceTypeInvalid: return @"invalid"; - case GTReferenceTypeOid: + case GTReferenceTypeDirect: return @"direct"; case GTReferenceTypeSymbolic: @@ -144,7 +144,7 @@ - (GTReferenceType)referenceType { } - (id)unresolvedTarget { - if (self.referenceType == GTReferenceTypeOid) { + if (self.referenceType == GTReferenceTypeDirect) { const git_oid *oid = git_reference_target(self.git_reference); if (oid == NULL) return nil; @@ -160,7 +160,7 @@ - (id)unresolvedTarget { - (id)resolvedTarget { git_object *obj; - if (git_reference_peel(&obj, self.git_reference, GIT_OBJ_ANY) != GIT_OK) { + if (git_reference_peel(&obj, self.git_reference, GIT_OBJECT_ANY) != GIT_OK) { return nil; } @@ -181,7 +181,7 @@ - (GTReference *)referenceByUpdatingTarget:(NSString *)newTarget message:(NSStri int gitError; git_reference *newRef = NULL; - if (git_reference_type(self.git_reference) == GIT_REF_OID) { + if (git_reference_type(self.git_reference) == GIT_REFERENCE_DIRECT) { GTOID *oid = [[GTOID alloc] initWithSHA:newTarget error:error]; if (oid == nil) return nil; diff --git a/ObjectiveGit/GTRepository.m b/ObjectiveGit/GTRepository.m index 851d81c28..133216cd4 100644 --- a/ObjectiveGit/GTRepository.m +++ b/ObjectiveGit/GTRepository.m @@ -317,7 +317,7 @@ + (instancetype _Nullable)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NS - (id)lookUpObjectByGitOid:(const git_oid *)oid objectType:(GTObjectType)type error:(NSError **)error { git_object *obj; - int gitError = git_object_lookup(&obj, self.git_repository, oid, (git_otype)type); + int gitError = git_object_lookup(&obj, self.git_repository, oid, (git_object_t)type); if (gitError < GIT_OK) { if (error != NULL) { char oid_str[GIT_OID_HEXSZ+1]; @@ -683,13 +683,13 @@ - (NSString *)preparedMessageWithError:(NSError * __autoreleasing *)error { int errorCode = git_repository_message(&msg, self.git_repository); if (errorCode != GIT_OK) { setErrorFromCode(errorCode); - git_buf_free(&msg); + git_buf_dispose(&msg); return nil; } NSString *message = [[NSString alloc] initWithBytes:msg.ptr length:msg.size encoding:NSUTF8StringEncoding]; - git_buf_free(&msg); + git_buf_dispose(&msg); return message; } diff --git a/ObjectiveGit/GTTreeBuilder.m b/ObjectiveGit/GTTreeBuilder.m index 5ae85646a..d53118e9d 100644 --- a/ObjectiveGit/GTTreeBuilder.m +++ b/ObjectiveGit/GTTreeBuilder.m @@ -155,7 +155,7 @@ - (GTTree *)writeTree:(NSError **)error { } git_object *object = NULL; - status = git_object_lookup(&object, self.repository.git_repository, &treeOid, GIT_OBJ_TREE); + status = git_object_lookup(&object, self.repository.git_repository, &treeOid, GIT_OBJECT_TREE); if (status != GIT_OK) { if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to lookup tree in repository."]; return nil; diff --git a/ObjectiveGitTests/GTReferenceSpec.m b/ObjectiveGitTests/GTReferenceSpec.m index 811a7e952..a3b9b4022 100644 --- a/ObjectiveGitTests/GTReferenceSpec.m +++ b/ObjectiveGitTests/GTReferenceSpec.m @@ -135,7 +135,7 @@ expect(ref).notTo(beNil()); expect(error).to(beNil()); - expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/master"); + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeDirect, @"refs/heads/master"); }); it(@"should return a valid reference to a tag", ^{ @@ -144,7 +144,7 @@ expect(ref).notTo(beNil()); expect(error).to(beNil()); - expectValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeOid, @"refs/tags/v0.9"); + expectValidReference(ref, @"5b5b025afb0b4c913b4c338a42934a3863bf3644", GTReferenceTypeDirect, @"refs/tags/v0.9"); }); }); @@ -170,7 +170,7 @@ expect(error).to(beNil()); expect(ref).notTo(beNil()); - expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeOid, @"refs/heads/unit_test"); + expectValidReference(ref, @"36060c58702ed4c2a40832c51758d5344201d89a", GTReferenceTypeDirect, @"refs/heads/unit_test"); }); }); diff --git a/ObjectiveGitTests/GTRepositorySpec.m b/ObjectiveGitTests/GTRepositorySpec.m index 8da554cc8..2ff1aaf88 100644 --- a/ObjectiveGitTests/GTRepositorySpec.m +++ b/ObjectiveGitTests/GTRepositorySpec.m @@ -114,7 +114,7 @@ expect(head).notTo(beNil()); expect(error).to(beNil()); expect(head.targetOID.SHA).to(equal(@"36060c58702ed4c2a40832c51758d5344201d89a")); - expect(@(head.referenceType)).to(equal(@(GTReferenceTypeOid))); + expect(@(head.referenceType)).to(equal(@(GTReferenceTypeDirect))); }); it(@"should handle bare clones", ^{ @@ -139,7 +139,7 @@ expect(head).notTo(beNil()); expect(error).to(beNil()); expect(head.targetOID.SHA).to(equal(@"36060c58702ed4c2a40832c51758d5344201d89a")); - expect(@(head.referenceType)).to(equal(@(GTReferenceTypeOid))); + expect(@(head.referenceType)).to(equal(@(GTReferenceTypeDirect))); }); it(@"should have set a valid remote URL", ^{ @@ -212,7 +212,7 @@ expect(head).notTo(beNil()); expect(error).to(beNil()); expect(head.targetOID.SHA).to(equal(@"36060c58702ed4c2a40832c51758d5344201d89a")); - expect(@(head.referenceType)).to(equal(@(GTReferenceTypeOid))); + expect(@(head.referenceType)).to(equal(@(GTReferenceTypeDirect))); }); it(@"should fail to return HEAD for an unborn repo", ^{