Skip to content

Commit e1e933b

Browse files
MikeJerredehuss
authored andcommitted
fix: mark to_raw as unsafe
1 parent b76c8be commit e1e933b

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
@@ -661,7 +661,7 @@ impl IndexEntry {
661661
///
662662
/// The returned `raw::git_index_entry` contains a pointer to a `CString` path, which is also
663663
/// returned because it's lifetime must exceed the lifetime of the `raw::git_index_entry`.
664-
pub fn to_raw(&self) -> Result<(raw::git_index_entry, CString), Error> {
664+
pub(crate) unsafe fn to_raw(&self) -> Result<(raw::git_index_entry, CString), Error> {
665665
let path = CString::new(&self.path[..])?;
666666

667667
// 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
@@ -2577,11 +2577,11 @@ impl Repository {
25772577
theirs: &IndexEntry,
25782578
opts: Option<&mut MergeFileOptions>,
25792579
) -> Result<MergeFileResult<'_>, Error> {
2580-
let (ancestor, _ancestor_path) = ancestor.to_raw()?;
2581-
let (ours, _ours_path) = ours.to_raw()?;
2582-
let (theirs, _theirs_path) = theirs.to_raw()?;
2583-
25842580
unsafe {
2581+
let (ancestor, _ancestor_path) = ancestor.to_raw()?;
2582+
let (ours, _ours_path) = ours.to_raw()?;
2583+
let (theirs, _theirs_path) = theirs.to_raw()?;
2584+
25852585
let mut ret = mem::zeroed();
25862586
try_call!(raw::git_merge_file_from_index(
25872587
&mut ret,

0 commit comments

Comments
 (0)