From 64ebe7d96fd92fe3805fc6c347b2c75b3a203af3 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 16 Jan 2021 20:24:15 +0800 Subject: [PATCH] fix: call init() before setting global state --- src/opts.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/opts.rs b/src/opts.rs index ca36804e92..728d15e1cd 100644 --- a/src/opts.rs +++ b/src/opts.rs @@ -22,6 +22,7 @@ pub unsafe fn set_search_path

(level: ConfigLevel, path: P) -> Result<(), Erro where P: IntoCString, { + crate::init(); call::c_try(raw::git_libgit2_opts( raw::GIT_OPT_SET_SEARCH_PATH as libc::c_int, level as libc::c_int, @@ -40,6 +41,7 @@ where /// thread-safety. It needs to be externally synchronized with calls to access /// the global state. pub unsafe fn reset_search_path(level: ConfigLevel) -> Result<(), Error> { + crate::init(); call::c_try(raw::git_libgit2_opts( raw::GIT_OPT_SET_SEARCH_PATH as libc::c_int, level as libc::c_int, @@ -57,6 +59,7 @@ pub unsafe fn reset_search_path(level: ConfigLevel) -> Result<(), Error> { /// thread-safety. It needs to be externally synchronized with calls to access /// the global state. pub unsafe fn get_search_path(level: ConfigLevel) -> Result { + crate::init(); let buf = Buf::new(); call::c_try(raw::git_libgit2_opts( raw::GIT_OPT_GET_SEARCH_PATH as libc::c_int,