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