Skip to content

fix: call init() before setting global state #661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2021
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
3 changes: 3 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub unsafe fn set_search_path<P>(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,
Expand All @@ -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,
Expand All @@ -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<CString, Error> {
crate::init();
let buf = Buf::new();
call::c_try(raw::git_libgit2_opts(
raw::GIT_OPT_GET_SEARCH_PATH as libc::c_int,
Expand Down