Skip to content

Commit 384276a

Browse files
committed
fix: mark to_raw as unsafe
1 parent e3e023a commit 384276a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/index.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ impl IndexEntry {
619619
///
620620
/// The returned `raw::git_index_entry` contains a pointer to a `CString` path, which is also
621621
/// returned because it's lifetime must exceed the lifetime of the `raw::git_index_entry`.
622-
pub fn to_raw(&self) -> Result<(raw::git_index_entry, CString), Error> {
622+
pub(crate) unsafe fn to_raw(&self) -> Result<(raw::git_index_entry, CString), Error> {
623623
let path = CString::new(&self.path[..])?;
624624

625625
// libgit2 encodes the length of the path in the lower bits of the

src/repo.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2516,11 +2516,11 @@ impl Repository {
25162516
theirs: &IndexEntry,
25172517
opts: Option<&mut MergeFileOptions>,
25182518
) -> Result<MergeFileResult<'_>, Error> {
2519-
let (ancestor, _ancestor_path) = ancestor.to_raw()?;
2520-
let (ours, _ours_path) = ours.to_raw()?;
2521-
let (theirs, _theirs_path) = theirs.to_raw()?;
2522-
25232519
unsafe {
2520+
let (ancestor, _ancestor_path) = ancestor.to_raw()?;
2521+
let (ours, _ours_path) = ours.to_raw()?;
2522+
let (theirs, _theirs_path) = theirs.to_raw()?;
2523+
25242524
let mut ret = mem::zeroed();
25252525
try_call!(raw::git_merge_file_from_index(
25262526
&mut ret,

0 commit comments

Comments
 (0)