Skip to content

Commit 5e4c980

Browse files
committed
Update libgit2 to 1.1.0
1 parent 71ed4f1 commit 5e4c980

18 files changed

+47
-47
lines changed

External/libgit2

Submodule libgit2 updated 1251 files

ObjectiveGit.modulemap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ framework module ObjectiveGit {
6464
header "git2/sys/refs.h"
6565
header "git2/sys/repository.h"
6666
header "git2/sys/transport.h"
67-
header "git2/sys/time.h"
6867
header "git2/cred_helpers.h"
6968
header "git2/sys/openssl.h"
7069
header "git2/sys/stream.h"

ObjectiveGit/GTBlob.m

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ - (instancetype)initWithData:(NSData *)data inRepository:(GTRepository *)reposit
8484
NSParameterAssert(repository != nil);
8585

8686
git_oid oid;
87-
int gitError = git_blob_create_frombuffer(&oid, repository.git_repository, [data bytes], data.length);
87+
int gitError = git_blob_create_from_buffer(&oid, repository.git_repository, [data bytes], data.length);
8888
if(gitError < GIT_OK) {
8989
if(error != NULL) {
9090
*error = [NSError git_errorFor:gitError description:@"Failed to create blob from NSData"];
@@ -100,7 +100,7 @@ - (instancetype)initWithFile:(NSURL *)file inRepository:(GTRepository *)reposito
100100
NSParameterAssert(repository != nil);
101101

102102
git_oid oid;
103-
int gitError = git_blob_create_fromdisk(&oid, repository.git_repository, [[file path] fileSystemRepresentation]);
103+
int gitError = git_blob_create_from_disk(&oid, repository.git_repository, [[file path] fileSystemRepresentation]);
104104
if(gitError < GIT_OK) {
105105
if(error != NULL) {
106106
*error = [NSError git_errorFor:gitError description:@"Failed to create blob from NSURL"];
@@ -137,7 +137,9 @@ - (NSData *)applyFiltersForPath:(NSString *)path error:(NSError * __autoreleasin
137137
NSCParameterAssert(path != nil);
138138

139139
git_buf buffer = GIT_BUF_INIT_CONST(0, NULL);
140-
int gitError = git_blob_filtered_content(&buffer, self.git_blob, path.UTF8String, 1);
140+
141+
git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
142+
int gitError = git_blob_filter(&buffer, self.git_blob, path.UTF8String, &opts);
141143
if (gitError != GIT_OK) {
142144
if (error != NULL) *error = [NSError git_errorFor:gitError description:@"Failed to apply filters for path %@ to blob", path];
143145
return nil;

ObjectiveGit/GTConfiguration.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ - (NSArray *)remotes {
146146
}
147147
}
148148

149-
git_strarray_free(&names);
149+
git_strarray_dispose(&names);
150150

151151
return remotes;
152152
}

ObjectiveGit/GTCredential+Private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ typedef struct {
2727
__unsafe_unretained GTCredentialProvider *credProvider;
2828
} GTCredentialAcquireCallbackInfo;
2929

30-
int GTCredentialAcquireCallback(git_cred **cred, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload);
30+
int GTCredentialAcquireCallback(git_credential **cred, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload);

ObjectiveGit/GTCredential.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
/// An enum describing the data needed for authentication.
1313
/// See `git_credtype_t`.
1414
typedef NS_ENUM(NSInteger, GTCredentialType) {
15-
GTCredentialTypeUserPassPlaintext = GIT_CREDTYPE_USERPASS_PLAINTEXT,
16-
GTCredentialTypeSSHKey = GIT_CREDTYPE_SSH_KEY,
17-
GTCredentialTypeSSHCustom = GIT_CREDTYPE_SSH_CUSTOM,
15+
GTCredentialTypeUserPassPlaintext = GIT_CREDENTIAL_USERPASS_PLAINTEXT,
16+
GTCredentialTypeSSHKey = GIT_CREDENTIAL_SSH_KEY,
17+
GTCredentialTypeSSHCustom = GIT_CREDENTIAL_SSH_CUSTOM,
1818
};
1919

2020
NS_ASSUME_NONNULL_BEGIN
@@ -50,7 +50,7 @@ NS_ASSUME_NONNULL_BEGIN
5050
@end
5151

5252
/// The GTCredential class is used to provide authentication data.
53-
/// It acts as a wrapper around `git_cred` objects.
53+
/// It acts as a wrapper around `git_credential` objects.
5454
@interface GTCredential : NSObject
5555

5656
/// Create a credential object from a username/password pair.
@@ -86,8 +86,8 @@ NS_ASSUME_NONNULL_BEGIN
8686
/// Return a new GTCredential instance, or nil if an error occurred
8787
+ (instancetype _Nullable)credentialWithUserName:(NSString *)userName publicKeyString:(NSString * _Nullable)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(NSString * _Nullable)passphrase error:(NSError * __autoreleasing *)error;
8888

89-
/// The underlying `git_cred` object.
90-
- (git_cred *)git_cred __attribute__((objc_returns_inner_pointer));
89+
/// The underlying `git_credential` object.
90+
- (git_credential *)git_credential __attribute__((objc_returns_inner_pointer));
9191

9292
@end
9393

ObjectiveGit/GTCredential.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ - (GTCredential *)credentialForType:(GTCredentialType)type URL:(NSString *)URL u
3939
@end
4040

4141
@interface GTCredential ()
42-
@property (nonatomic, assign, readonly) git_cred *git_cred;
42+
@property (nonatomic, assign, readonly) git_credential *git_credential;
4343
@end
4444

4545
@implementation GTCredential
4646

4747
+ (instancetype)credentialWithUserName:(NSString *)userName password:(NSString *)password error:(NSError * __autoreleasing *)error {
48-
git_cred *cred;
49-
int gitError = git_cred_userpass_plaintext_new(&cred, userName.UTF8String, password.UTF8String);
48+
git_credential *cred;
49+
int gitError = git_credential_userpass_plaintext_new(&cred, userName.UTF8String, password.UTF8String);
5050
if (gitError != GIT_OK) {
5151
if (error) *error = [NSError git_errorFor:gitError description:@"Failed to create credentials object" failureReason:@"There was an error creating a credential object for username %@.", userName];
5252
return nil;
@@ -61,8 +61,8 @@ + (instancetype)credentialWithUserName:(NSString *)userName publicKeyURL:(NSURL
6161
NSString *privateKeyPath = privateKeyURL.filePathURL.path;
6262
NSAssert(privateKeyPath != nil, @"Invalid file URL passed: %@", privateKeyURL);
6363

64-
git_cred *cred;
65-
int gitError = git_cred_ssh_key_new(&cred, userName.UTF8String, publicKeyPath.fileSystemRepresentation, privateKeyPath.fileSystemRepresentation, passphrase.UTF8String);
64+
git_credential *cred;
65+
int gitError = git_credential_ssh_key_new(&cred, userName.UTF8String, publicKeyPath.fileSystemRepresentation, privateKeyPath.fileSystemRepresentation, passphrase.UTF8String);
6666
if (gitError != GIT_OK) {
6767
if (error) *error = [NSError git_errorFor:gitError description:@"Failed to create credentials object" failureReason:@"There was an error creating a credential object for username %@ with the provided public/private key pair.\nPublic key: %@\nPrivate key: %@", userName, publicKeyURL, privateKeyURL];
6868
return nil;
@@ -74,8 +74,8 @@ + (instancetype)credentialWithUserName:(NSString *)userName publicKeyURL:(NSURL
7474
+ (instancetype)credentialWithUserName:(NSString *)userName publicKeyString:(NSString *)publicKeyString privateKeyString:(NSString *)privateKeyString passphrase:(NSString *)passphrase error:(NSError * __autoreleasing *)error {
7575
NSParameterAssert(privateKeyString != nil);
7676

77-
git_cred *cred;
78-
int gitError = git_cred_ssh_key_memory_new(&cred, userName.UTF8String, publicKeyString.UTF8String, privateKeyString.UTF8String, passphrase.UTF8String);
77+
git_credential *cred;
78+
int gitError = git_credential_ssh_key_memory_new(&cred, userName.UTF8String, publicKeyString.UTF8String, privateKeyString.UTF8String, passphrase.UTF8String);
7979
if (gitError != GIT_OK) {
8080
if (error) *error = [NSError git_errorFor:gitError description:@"Failed to create credentials object" failureReason:@"There was an error creating a credential object for username %@ with the provided public/private key pair.\nPublic key: %@", userName, publicKeyString];
8181
return nil;
@@ -84,21 +84,21 @@ + (instancetype)credentialWithUserName:(NSString *)userName publicKeyString:(NSS
8484
return [[self alloc] initWithGitCred:cred];
8585
}
8686

87-
- (instancetype)initWithGitCred:(git_cred *)cred {
87+
- (instancetype)initWithGitCred:(git_credential *)cred {
8888
NSParameterAssert(cred != nil);
8989
self = [self init];
9090

9191
if (self == nil) return nil;
9292

93-
_git_cred = cred;
93+
_git_credential = cred;
9494

9595
return self;
9696
}
9797

9898
@end
9999

100-
int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload) {
101-
NSCParameterAssert(git_cred != NULL);
100+
int GTCredentialAcquireCallback(git_credential **git_credential, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload) {
101+
NSCParameterAssert(git_credential != NULL);
102102
NSCParameterAssert(payload != NULL);
103103

104104
GTCredentialAcquireCallbackInfo *info = payload;
@@ -118,6 +118,6 @@ int GTCredentialAcquireCallback(git_cred **git_cred, const char *url, const char
118118
return GIT_ERROR;
119119
}
120120

121-
*git_cred = cred.git_cred;
121+
*git_credential = cred.git_credential;
122122
return GIT_OK;
123123
}

ObjectiveGit/GTDiff.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ + (int)handleParsedOptionsDictionary:(NSDictionary *)dictionary usingBlock:(int
7171
git_strarray strArray = pathSpec.git_strarray;
7272
if (pathSpec != nil) newOptions.pathspec = strArray;
7373
@onExit {
74-
git_strarray_free((git_strarray *)&strArray);
74+
git_strarray_dispose((git_strarray *)&strArray);
7575
};
7676

7777
git_diff_options *optionsPtr = &newOptions;

ObjectiveGit/GTIndex.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ - (BOOL)addData:(NSData *)data withPath:(NSString *)path error:(NSError * __auto
196196
entry.path = [path cStringUsingEncoding:NSUTF8StringEncoding];
197197
entry.mode = GIT_FILEMODE_BLOB;
198198

199-
int status = git_index_add_frombuffer(self.git_index, &entry, [data bytes], [data length]);
199+
int status = git_index_add_from_buffer(self.git_index, &entry, [data bytes], [data length]);
200200

201201
if (status != GIT_OK) {
202202
if (error != NULL) *error = [NSError git_errorFor:status description:@"Failed to add data with name %@ into index.", path];

ObjectiveGit/GTOID.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ + (instancetype)oidWithSHACString:(const char *)SHA {
9898
}
9999

100100
- (BOOL)isZero {
101-
return git_oid_iszero(self.git_oid) != 0;
101+
return git_oid_is_zero(self.git_oid) != 0;
102102
}
103103

104104
#pragma mark NSObject

0 commit comments

Comments
 (0)