static int get_check_cert(int *out, git_repository *repo) { git_config *cfg; const char *val; int error = 0; assert(out && repo); /* By default, we *DO* want to verify the certificate. */ *out = 1; /* Go through the possible sources for SSL verification settings, from * most specific to least specific. */ /* GIT_SSL_NO_VERIFY environment variable */ if ((val = getenv("GIT_SSL_NO_VERIFY")) != NULL) return git_config_parse_bool(out, val); /* http.sslVerify config setting */ if ((error = git_repository_config__weakptr(&cfg, repo)) < 0) return error; *out = git_config__get_bool_force(cfg, "http.sslverify", 1); return 0; }
int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar) { int error = 0; struct map_data *data = &_cvar_maps[(int)cvar]; const git_config_entry *entry; git_config__lookup_entry(&entry, config, data->cvar_name, false); if (!entry) *out = data->default_value; else if (data->maps) error = git_config_lookup_map_value( out, data->maps, data->map_count, entry->value); else error = git_config_parse_bool(out, entry->value); return error; }
PyObject * Config_getitem(Config *self, PyObject *py_key) { int64_t value_int; int err, value_bool; const char *value_str; char *key; PyObject* py_value; key = py_str_to_c_str(py_key, NULL); if (key == NULL) return NULL; err = git_config_get_string(&value_str, self->config, key); if (err < 0) goto cleanup; if (git_config_parse_int64(&value_int, value_str) == 0) py_value = PyLong_FromLongLong(value_int); else if(git_config_parse_bool(&value_bool, value_str) == 0) py_value = PyBool_FromLong(value_bool); else py_value = to_unicode(value_str, NULL, NULL); cleanup: free(key); if (err < 0) { if (err == GIT_ENOTFOUND) { PyErr_SetObject(PyExc_KeyError, py_key); return NULL; } return Error_set(err); } return py_value; }