| @@ -1,17 +1,16 @@ |
| 1 | 1 | //! |
| 2 | 2 | use std::cell::{Ref, RefCell, RefMut}; |
| 3 | 3 | |
| 4 | | −use crate::{easy, easy::borrow, Repository}; |
| 4 | +use crate::{easy, easy::borrow}; |
| 5 | 5 | |
| 6 | 6 | impl Clone for easy::State { |
| 7 | 7 | fn clone(&self) -> Self { |
| 8 | | − self.refs.clone().into() |
| 8 | + easy::State::from_refs_and_objects(self.refs.clone(), self.objects.clone()) |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | | −// TODO: Expand this as needed as more higher-level stores exist (i.e. odb) |
| 13 | | −impl From<crate::RefStore> for easy::State { |
| 14 | | − fn from(refs: crate::RefStore) -> Self { |
| 12 | +impl easy::State { |
| 13 | + pub(crate) fn from_refs_and_objects(refs: crate::RefStore, objects: crate::OdbHandle) -> Self { |
| 15 | 14 | easy::State { |
| 16 | 15 | #[cfg(not(feature = "max-performance"))] |
| 17 | 16 | pack_cache: RefCell::new(git_pack::cache::Never), |
| @@ -19,14 +18,15 @@ impl From<crate::RefStore> for easy::State { · 1 unmodified line |
| 19 | 18 | pack_cache: RefCell::new(Box::new(git_pack::cache::lru::StaticLinkedList::<64>::default())), |
| 20 | 19 | object_cache: RefCell::new(None), |
| 21 | 20 | buf: RefCell::new(vec![]), |
| 21 | + objects, |
| 22 | 22 | refs, |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | | −impl From<&Repository> for easy::State { |
| 28 | | − fn from(repo: &Repository) -> Self { |
| 29 | | − repo.refs.clone().into() |
| 27 | +impl From<&crate::Repository> for easy::State { |
| 28 | + fn from(repo: &crate::Repository) -> Self { |
| 29 | + easy::State::from_refs_and_objects(repo.refs.clone(), repo.odb.to_handle_shared()) |
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |