File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ extern NSString * const GTRepositoryCloneOptionsCredentialProvider;
106
106
// / A BOOL indicating whether local clones should actually clone, or just link.
107
107
extern NSString * const GTRepositoryCloneOptionsCloneLocal;
108
108
109
+ // / A NSURL pointing to a local file that contains PEM-encoded certificate chain.
110
+ extern NSString *const GTRepositoryCloneOptionsServerCertificateURL;
111
+
109
112
// / Initialization flags associated with `GTRepositoryInitOptionsFlags` for
110
113
// / +initializeEmptyRepositoryAtFileURL:options:error:.
111
114
// /
@@ -199,7 +202,8 @@ extern NSString * const GTRepositoryInitOptionsOriginURLString;
199
202
// / `GTRepositoryCloneOptionsBare`,
200
203
// / `GTRepositoryCloneOptionsCheckout`,
201
204
// / `GTRepositoryCloneOptionsCredentialProvider`,
202
- // / `GTRepositoryCloneOptionsCloneLocal`
205
+ // / `GTRepositoryCloneOptionsCloneLocal`,
206
+ // / `GTRepositoryCloneOptionsServerCertificateURL`
203
207
// / error - A pointer to fill in case of trouble.
204
208
// / transferProgressBlock - This block is called with network transfer updates.
205
209
// / checkoutProgressBlock - This block is called with checkout updates
Original file line number Diff line number Diff line change 59
59
NSString * const GTRepositoryCloneOptionsTransportFlags = @" GTRepositoryCloneOptionsTransportFlags" ;
60
60
NSString * const GTRepositoryCloneOptionsCredentialProvider = @" GTRepositoryCloneOptionsCredentialProvider" ;
61
61
NSString * const GTRepositoryCloneOptionsCloneLocal = @" GTRepositoryCloneOptionsCloneLocal" ;
62
+ NSString * const GTRepositoryCloneOptionsServerCertificateURL = @" GTRepositoryCloneOptionsServerCertificateURL" ;
62
63
NSString * const GTRepositoryInitOptionsFlags = @" GTRepositoryInitOptionsFlags" ;
63
64
NSString * const GTRepositoryInitOptionsMode = @" GTRepositoryInitOptionsMode" ;
64
65
NSString * const GTRepositoryInitOptionsWorkingDirectoryPath = @" GTRepositoryInitOptionsWorkingDirectoryPath" ;
@@ -265,6 +266,15 @@ + (id)cloneFromURL:(NSURL *)originURL toWorkingDirectory:(NSURL *)workdirURL opt
265
266
if (localClone) {
266
267
cloneOptions.local = GIT_CLONE_NO_LOCAL;
267
268
}
269
+
270
+ NSURL *serverCertificateURL = options[GTRepositoryCloneOptionsServerCertificateURL];
271
+ if (serverCertificateURL) {
272
+ int gitError = git_libgit2_opts (GIT_OPT_SET_SSL_CERT_LOCATIONS, serverCertificateURL.fileSystemRepresentation , NULL );
273
+ if (gitError < GIT_OK) {
274
+ if (error != NULL ) *error = [NSError git_errorFor: gitError description: @" Failed to configure the server certificate at %@ " , serverCertificateURL];
275
+ return nil ;
276
+ }
277
+ }
268
278
269
279
// If our originURL is local, convert to a path before handing down.
270
280
const char *remoteURL = NULL ;
You can’t perform that action at this time.
0 commit comments