File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,36 @@ option(PyObject *self, PyObject *args)
272
272
return tup ;
273
273
}
274
274
275
+ case GIT_OPT_SET_SSL_CERT_LOCATIONS :
276
+ {
277
+ PyObject * py_file , * py_dir ;
278
+ const char * file_path , * dir_path ;
279
+ int err ;
280
+
281
+ py_file = PyTuple_GetItem (args , 1 );
282
+ py_dir = PyTuple_GetItem (args , 2 );
283
+
284
+ /* py_file and py_dir are only valid if they are strings */
285
+ if (PyUnicode_Check (py_file ) || PyBytes_Check (py_file )) {
286
+ file_path = py_str_to_c_str (py_file , Py_FileSystemDefaultEncoding );
287
+ } else {
288
+ file_path = NULL ;
289
+ }
290
+
291
+ if (PyUnicode_Check (py_dir ) || PyBytes_Check (py_dir )) {
292
+ dir_path = py_str_to_c_str (py_dir , Py_FileSystemDefaultEncoding );
293
+ } else {
294
+ dir_path = NULL ;
295
+ }
296
+
297
+ err = git_libgit2_opts (GIT_OPT_SET_SSL_CERT_LOCATIONS , file_path , dir_path );
298
+
299
+ if (err < 0 )
300
+ return Error_set (err );
301
+
302
+ Py_RETURN_NONE ;
303
+ }
304
+
275
305
}
276
306
277
307
PyErr_SetString (PyExc_ValueError , "unknown/unsupported option value" );
Original file line number Diff line number Diff line change @@ -242,6 +242,7 @@ moduleinit(PyObject* m)
242
242
ADD_CONSTANT_INT (m , GIT_OPT_GET_CACHED_MEMORY );
243
243
ADD_CONSTANT_INT (m , GIT_OPT_ENABLE_CACHING );
244
244
ADD_CONSTANT_INT (m , GIT_OPT_SET_CACHE_MAX_SIZE );
245
+ ADD_CONSTANT_INT (m , GIT_OPT_SET_SSL_CERT_LOCATIONS );
245
246
246
247
/* Errors */
247
248
GitError = PyErr_NewException ("_pygit2.GitError" , NULL , NULL );
You can’t perform that action at this time.
0 commit comments