Skip to content
Open
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
16 changes: 16 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,22 @@ pub unsafe fn set_server_timeout_in_milliseconds(timeout: libc::c_int) -> Result
Ok(())
}

/// Sets the directory used as the current user's home directory, for file lookups
///
/// # Safety
/// This function is modifying a C global without synchronization, so it is not
/// thread safe, and should only be called before any thread is spawned.
pub unsafe fn set_homedir(homedir: std::ffi::CString) -> Result<(), Error> {
crate::init();

try_call!(raw::git_libgit2_opts(
raw::GIT_OPT_SET_HOMEDIR as libc::c_int,
homedir.as_ptr()
));

Ok(())
}

#[cfg(test)]
mod test {
use super::*;
Expand Down
Loading