diff --git a/gix/src/submodule/mod.rs b/gix/src/submodule/mod.rs index ff88f3b439b..6ebe3f07118 100644 --- a/gix/src/submodule/mod.rs +++ b/gix/src/submodule/mod.rs @@ -10,7 +10,7 @@ use std::{ use gix_odb::FindExt; pub use gix_submodule::*; -use crate::{bstr::BStr, ext::ObjectIdExt, repository::IndexPersistedOrInMemory, Id, Repository, Submodule}; +use crate::{bstr::BStr, repository::IndexPersistedOrInMemory, Repository, Submodule}; pub(crate) type ModulesFileStorage = gix_features::threading::OwnShared>; /// A lazily loaded and auto-updated worktree index. @@ -164,13 +164,9 @@ impl<'repo> Submodule<'repo> { /// If `None`, but `Some()` when calling [`Self::head_id()`], then the submodule was just deleted but the change /// wasn't yet committed. /// If `Some()`, but `None` when calling [`Self::head_id()`], then the submodule was just added without having committed the change. - pub fn index_id(&self) -> Result>, index_id::Error> { + pub fn index_id(&self) -> Result, index_id::Error> { let path = self.path()?; - Ok(self - .state - .index()? - .entry_by_path(&path) - .map(|entry| entry.id.attach(self.state.repo))) + Ok(self.state.index()?.entry_by_path(&path).map(|entry| entry.id)) } /// Return the object id of the submodule as stored in `HEAD^{tree}` of the superproject, or `None` if it wasn't yet committed. @@ -178,7 +174,7 @@ impl<'repo> Submodule<'repo> { /// If `Some()`, but `None` when calling [`Self::index_id()`], then the submodule was just deleted but the change /// wasn't yet committed. /// If `None`, but `Some()` when calling [`Self::index_id()`], then the submodule was just added without having committed the change. - pub fn head_id(&self) -> Result>, head_id::Error> { + pub fn head_id(&self) -> Result, head_id::Error> { let path = self.path()?; Ok(self .state @@ -186,7 +182,7 @@ impl<'repo> Submodule<'repo> { .head_commit()? .tree()? .peel_to_entry_by_path(gix_path::from_bstr(path.as_ref()))? - .map(|entry| entry.id())) + .map(|entry| entry.inner.oid)) } /// Return the path at which the repository of the submodule should be located. diff --git a/gix/tests/repository/submodule.rs b/gix/tests/repository/submodule.rs index b83990074c9..0d855885d23 100644 --- a/gix/tests/repository/submodule.rs +++ b/gix/tests/repository/submodule.rs @@ -58,7 +58,7 @@ mod modules_file { } mod submodules { - use gix::{bstr::BString, Id}; + use gix::bstr::BString; use crate::{submodule::repo, util::hex_to_id}; @@ -72,8 +72,8 @@ mod submodules { .map(|sm| ( sm.name().to_owned(), sm.path().expect("valid path").into_owned(), - sm.head_id().expect("valid").map(Id::detach), - sm.index_id().expect("valid").map(Id::detach), + sm.head_id().expect("valid"), + sm.index_id().expect("valid"), sm.is_active().expect("no config error") )) .collect::>(),