Skip to content

Commit 53fd0fb

Browse files
authored
fix: call init() before setting global state (#661)
1 parent 252f41b commit 53fd0fb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/opts.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub unsafe fn set_search_path<P>(level: ConfigLevel, path: P) -> Result<(), Erro
2222
where
2323
P: IntoCString,
2424
{
25+
crate::init();
2526
call::c_try(raw::git_libgit2_opts(
2627
raw::GIT_OPT_SET_SEARCH_PATH as libc::c_int,
2728
level as libc::c_int,
@@ -40,6 +41,7 @@ where
4041
/// thread-safety. It needs to be externally synchronized with calls to access
4142
/// the global state.
4243
pub unsafe fn reset_search_path(level: ConfigLevel) -> Result<(), Error> {
44+
crate::init();
4345
call::c_try(raw::git_libgit2_opts(
4446
raw::GIT_OPT_SET_SEARCH_PATH as libc::c_int,
4547
level as libc::c_int,
@@ -57,6 +59,7 @@ pub unsafe fn reset_search_path(level: ConfigLevel) -> Result<(), Error> {
5759
/// thread-safety. It needs to be externally synchronized with calls to access
5860
/// the global state.
5961
pub unsafe fn get_search_path(level: ConfigLevel) -> Result<CString, Error> {
62+
crate::init();
6063
let buf = Buf::new();
6164
call::c_try(raw::git_libgit2_opts(
6265
raw::GIT_OPT_GET_SEARCH_PATH as libc::c_int,

0 commit comments

Comments
 (0)