diff --git a/External/libgit2 b/External/libgit2 index 49e408b3..f28579db 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit 49e408b3208bc3093757a1c2db938d3590f3f412 +Subproject commit f28579db11737eaa2ced18498e229967a12f1c3f diff --git a/ObjectiveGit/GTOID.m b/ObjectiveGit/GTOID.m index 23412df4..fdd0ec6b 100644 --- a/ObjectiveGit/GTOID.m +++ b/ObjectiveGit/GTOID.m @@ -10,7 +10,7 @@ #import "NSError+Git.h" #import "git2/errors.h" -#import "git2/odb.h" +#import "git2/object.h" @interface GTOID () { git_oid _git_oid; @@ -133,7 +133,9 @@ + (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_object_t)type); + git_object_id_options options = GIT_OBJECT_ID_OPTIONS_INIT; + options.object_type = (git_object_t)type; + int gitError = git_object_id_from_buffer(&oid, data.bytes, data.length, &options); 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 e562e8dc..e8762eb2 100644 --- a/ObjectiveGit/GTObject.h +++ b/ObjectiveGit/GTObject.h @@ -37,8 +37,9 @@ typedef NS_ENUM(int, GTObjectType) { 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. */ + // Pack-only types are no longer part of libgit2's public object enum. + GTObjectTypeOffsetDelta = 6, /**< A delta, base is given by an offset. */ + GTObjectTypeRefDelta = 7, /**< A delta, base is given by object id. */ }; @class GTRepository; diff --git a/ObjectiveGit/GTRepository.h b/ObjectiveGit/GTRepository.h index d1c4819c..fe638ee9 100644 --- a/ObjectiveGit/GTRepository.h +++ b/ObjectiveGit/GTRepository.h @@ -94,7 +94,13 @@ typedef NS_OPTIONS(NSInteger, GTRepositoryOpenFlags) { typedef NS_OPTIONS(NSInteger, GTRepositoryInitFlags) { GTRepositoryInitBare = GIT_REPOSITORY_INIT_BARE, GTRepositoryInitWithoutReinitializing = GIT_REPOSITORY_INIT_NO_REINIT, - GTRepositoryInitWithoutDotGit = GIT_REPOSITORY_INIT_NO_DOTGIT_DIR, + // In libgit2 1.9.7 this was a real bit (GIT_REPOSITORY_INIT_NO_DOTGIT_DIR, + // (1u << 2)) that stopped ".git" being appended to the given path. + // libgit2 2.0 dropped the flag entirely (`#define ... 0` in + // deprecated.h); the same effect is now implied whenever `workdir_path` + // is set on the init options. Nothing in GitX or this repo uses this + // flag, so it's kept only for source compatibility. + GTRepositoryInitWithoutDotGit __attribute__((deprecated("No longer has any effect since libgit2 2.0; set workdir_path on the init options instead."))) = 0, GTRepositoryInitCreatingRepositoryDirectory = GIT_REPOSITORY_INIT_MKDIR, GTRepositoryInitCreatingIntermediateDirectories = GIT_REPOSITORY_INIT_MKPATH, GTRepositoryInitWithExternalTemplate = GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE, diff --git a/script/update_libgit2 b/script/update_libgit2 index faf306e3..ddb9debe 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -69,6 +69,7 @@ cmake -DBUILD_SHARED_LIBS:BOOL=OFF \ -DBUILD_TESTS:BOOL=OFF \ -DTHREADSAFE:BOOL=ON \ -DUSE_SSH=libssh2 \ + -DUSE_GSSAPI:BOOL=OFF \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ .. cmake --build .