| @@ -1,6 +1,10 @@ |
| 1 | | −use crate::visit; |
| 2 | | −use crate::visit::changes::Error::Cancelled; |
| 3 | | −use crate::visit::record::{Action, Change, PathComponent, PathComponentUpdateMode}; |
| 1 | +use crate::{ |
| 2 | + visit, |
| 3 | + visit::{ |
| 4 | + changes::Error::Cancelled, |
| 5 | + record::{Action, Change, PathComponent, PathComponentUpdateMode}, |
| 6 | + }, |
| 7 | +}; |
| 4 | 8 | use git_hash::{oid, ObjectId}; |
| 5 | 9 | use git_object::{immutable, tree}; |
| 6 | 10 | use quick_error::quick_error; |
| @@ -22,10 +26,7 @@ quick_error! { · 15 unmodified lines |
| 22 | 26 | } |
| 23 | 27 | } |
| 24 | 28 | |
| 25 | | −impl<'a, Iter> visit::Changes<'a, Iter> |
| 26 | | −where |
| 27 | | − Iter: Iterator<Item = super::TreeEntryResult<'a>>, |
| 28 | | −{ |
| 29 | +impl<'a> visit::Changes<'a> { |
| 29 | 30 | /// Returns the changes that need to be applied to `self` to get `other`. |
| 30 | 31 | /// |
| 31 | 32 | /// # Notes |
| @@ -36,8 +37,8 @@ where · 4 unmodified lines |
| 36 | 37 | /// [git_cmp_rs]: https://github.com/Byron/gitoxide/blob/a4d5f99c8dc99bf814790928a3bf9649cd99486b/git-object/src/mutable/tree.rs#L52-L55 |
| 37 | 38 | /// |
| 38 | 39 | pub fn needed_to_obtain<LocateFn>( |
| 39 | | − self, |
| 40 | | − other: Iter, |
| 40 | + mut self, |
| 41 | + other: immutable::TreeIter<'a>, |
| 41 | 42 | _state: &mut visit::State, |
| 42 | 43 | _locate: LocateFn, |
| 43 | 44 | delegate: &mut impl visit::Record, |
| @@ -45,7 +46,7 @@ where · 1 unmodified line |
| 45 | 46 | where |
| 46 | 47 | LocateFn: for<'b> FnMut(&oid, &'b mut Vec<u8>) -> Option<immutable::Object<'b>>, |
| 47 | 48 | { |
| 48 | | − let mut lhs_entries = self.0; |
| 49 | + let mut lhs_entries = self.0.take().unwrap_or_default(); |
| 49 | 50 | let mut rhs_entries = other; |
| 50 | 51 | |
| 51 | 52 | let mut path_id = 0; |