Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub unsafe fn get_search_path(level: ConfigLevel) -> Result<CString, Error> {
/// Disabling this will cause repository objects to clear their caches when next
/// accessed.
pub fn enable_caching(enabled: bool) {
crate::init();
let error = unsafe {
raw::git_libgit2_opts(
raw::GIT_OPT_ENABLE_CACHING as libc::c_int,
Expand All @@ -94,6 +95,7 @@ pub fn enable_caching(enabled: bool) {
/// creation of objects that reference invalid objects (due to programming
/// error or repository corruption).
pub fn strict_object_creation(enabled: bool) {
crate::init();
let error = unsafe {
raw::git_libgit2_opts(
raw::GIT_OPT_ENABLE_STRICT_OBJECT_CREATION as libc::c_int,
Expand All @@ -110,6 +112,7 @@ pub fn strict_object_creation(enabled: bool) {
/// improve performance, at the cost of relying on repository integrity
/// without checking it.
pub fn strict_hash_verification(enabled: bool) {
crate::init();
let error = unsafe {
raw::git_libgit2_opts(
raw::GIT_OPT_ENABLE_STRICT_HASH_VERIFICATION as libc::c_int,
Expand Down Expand Up @@ -181,6 +184,7 @@ where
/// Set wheter or not to verify ownership before performing a repository.
/// Enabled by default, but disabling this can lead to code execution vulnerabilities.
pub unsafe fn set_verify_owner_validation(enabled: bool) -> Result<(), Error> {
crate::init();
let error = raw::git_libgit2_opts(
raw::GIT_OPT_SET_OWNER_VALIDATION as libc::c_int,
enabled as libc::c_int,
Expand Down